From patchwork Wed Mar 16 07:30:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 598153 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qQ37t6vxLz9ssM for ; Wed, 16 Mar 2016 18:31:21 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=eP4eW/7m; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=vAXzEIZnGsuw5TDro6o+WASZ+G9oGDkZTz+eOqNa7FP2M3IIt4 OHUgd4qNULtJWJauqAms9SaCMEimdf2N84dXOhGkKJ1K+8rgV/1lpRmSZ22ZStYH hPSQHlr1VbcGlc7V/CFZau6mdKm/9KOVIH3w+jQHq9DaGBuEF6RYFjBTg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=eSs3N/Arye28ZcqV8PCwKSlZzac=; b=eP4eW/7m8DiuYrYUDU28 Z3UcO0x0N75G3L2ZjxvCl/L3HQ8Q++5wz0XII/rBmSdO1djFnr+asi1YU3DItXnF DZTVy+bx1OQ8e7e3oma/WgmhvPcSvbT7eZrfnx+fksVaXjePNPSx2ww2EQEK8G9u 3y8+fv/GoAnAU6PTI2kmiS4= Received: (qmail 31436 invoked by alias); 16 Mar 2016 07:31:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 31421 invoked by uid 89); 16 Mar 2016 07:31:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:Wed, Hx-languages-length:2979 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 16 Mar 2016 07:30:59 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ag5ux-0004Rs-V1 from Tom_deVries@mentor.com ; Wed, 16 Mar 2016 00:30:56 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Wed, 16 Mar 2016 07:30:54 +0000 To: Richard Biener , Sebastian Pop CC: GCC Patches From: Tom de Vries Subject: [PATCH, PR68809] Fix same_close_phi_node Message-ID: <56E90B9A.1020305@mentor.com> Date: Wed, 16 Mar 2016 08:30:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 Hi, this patch fixes graphite PR68809, a 6 regression. The problem we run into is that we return true in same_close_phi_node for two single-argument phis, one with an int 0 argument, and one with a char 0 argument: ... _1 = PHI <(int)0> _2 = PHI <(char)0> ... The result types of the two phis are not the same though. So when we replace uses of _1 by uses of _2 in remove_duplicate_close_phi, we introduce type errors, which causes an ICE during gimple verification. The patch fixes this by testing for equality of the result type of the phis in same_close_phi_node. Bootstrapped and reg-tested on x86_64. OK for stage4 trunk? Thanks, - Tom Fix same_close_phi_node 2016-03-15 Tom de Vries PR tree-optimization/68809 * graphite-scop-detection.c (same_close_phi_node): Test if result types are the same. * gcc.dg/graphite/pr68809-2.c: New test. * gcc.dg/graphite/pr68809.c: New test. --- gcc/graphite-scop-detection.c | 6 ++++-- gcc/testsuite/gcc.dg/graphite/pr68809-2.c | 27 +++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/graphite/pr68809.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index 03b1c49..9161cb7 100644 --- a/gcc/graphite-scop-detection.c +++ b/gcc/graphite-scop-detection.c @@ -273,8 +273,10 @@ trivially_empty_bb_p (basic_block bb) static inline bool same_close_phi_node (gphi *p1, gphi *p2) { - return operand_equal_p (gimple_phi_arg_def (p1, 0), - gimple_phi_arg_def (p2, 0), 0); + return ((TREE_TYPE (gimple_phi_result (p1)) + == TREE_TYPE (gimple_phi_result (p2))) + && operand_equal_p (gimple_phi_arg_def (p1, 0), + gimple_phi_arg_def (p2, 0), 0)); } static void make_close_phi_nodes_unique (basic_block bb); diff --git a/gcc/testsuite/gcc.dg/graphite/pr68809-2.c b/gcc/testsuite/gcc.dg/graphite/pr68809-2.c new file mode 100644 index 0000000..e6639b8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr68809-2.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -floop-nest-optimize" } */ + +int ae, vs, gf; +char ue; + +void +kc (char); + +void +pm (void) +{ + unsigned int v9; + int td = (gf != 0); + while (vs) + { + kc (ue); + for (ae = 0; ae < 70; ++ae) + { + } + ae &= 4; + ae ^ td && ((ue = 0) != 0); + ++vs; + } + v9 = ue + 1; + ue - v9 && ((ue = 0) != 0); +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr68809.c b/gcc/testsuite/gcc.dg/graphite/pr68809.c new file mode 100644 index 0000000..1d75841 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr68809.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -floop-nest-optimize" } */ + +int ae, vs; +char ue; + +void +kc (char); + +void +pm (void) +{ + unsigned int v9; + int gf = 0; + vs = 1; + while (vs) + { + gf -= ue; + kc (ue); + for (ae = 0; ae < 70; ++ae) + { + } + ae &= 4; + ae ^ (gf != 0) && ((ue = 0) != 0); + } + v9 = ue + 1; + ue - v9 && ((ue = 0) != 0); +}