From patchwork Thu Dec 2 07:19:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 73944 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]) by ozlabs.org (Postfix) with SMTP id EABA5B6F11 for ; Thu, 2 Dec 2010 18:21:11 +1100 (EST) Received: (qmail 27199 invoked by alias); 2 Dec 2010 07:21:07 -0000 Received: (qmail 27179 invoked by uid 22791); 2 Dec 2010 07:21:05 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-gx0-f175.google.com (HELO mail-gx0-f175.google.com) (209.85.161.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 02 Dec 2010 07:20:59 +0000 Received: by gxk20 with SMTP id 20so4338320gxk.20 for ; Wed, 01 Dec 2010 23:20:57 -0800 (PST) Received: by 10.151.7.18 with SMTP id k18mr823534ybi.348.1291274457653; Wed, 01 Dec 2010 23:20:57 -0800 (PST) Received: from napoca (adsl-76-244-77-0.dsl.austtx.sbcglobal.net [76.244.77.0]) by mx.google.com with ESMTPS id z43sm137041yhc.10.2010.12.01.23.20.55 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 01 Dec 2010 23:20:56 -0800 (PST) Received: by napoca (sSMTP sendmail emulation); Thu, 02 Dec 2010 01:20:54 -0600 From: Sebastian Pop To: gcc-patches@gcc.gnu.org Cc: gcc-graphite@googlegroups.com, rguenther@suse.de, Sebastian Pop Subject: [PATCH] Fix PR45297: handle ADDR_EXPR in interpret_rhs_expr as in follow_ssa_edge_expr. Date: Thu, 2 Dec 2010 01:19:41 -0600 Message-Id: <1291274381-26572-1-git-send-email-sebpop@gmail.com> X-IsSubscribed: yes 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 Hi, This fixes the compilation of the testcase of PR45297 on 32-bit machines: the ICE occurs because we rewrite out-of-SSA a phi node for which scev manages to analyze: in this code : q_5 = &MEM[(void *)q_1 + 4294967288B]; : # q_1 = PHI if (q_1 != p_2(D)) goto ; else goto ; scev analysis is able to determine that q1 = {q_3, +, -8}_1 and in the same time, scev fails to analyze q5. And that triggers a rewrite of q_5 out of SSA making the scev analysis of q1 impossible in the code generator. I am testing this patch on amd64-linux, ok for trunk after test? Thanks, Sebastian 2010-12-01 Sebastian Pop PR middle-end/45297 * tree-scalar-evolution.c (interpret_rhs_expr): Handle ADDR_EXPR with MEM_REFs as POINTER_PLUS_EXPR. --- gcc/ChangeLog | 6 ++++++ gcc/tree-scalar-evolution.c | 21 ++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c9e7072..d38bc01 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2010-12-01 Sebastian Pop + PR middle-end/45297 + * tree-scalar-evolution.c (interpret_rhs_expr): Handle ADDR_EXPR + with MEM_REFs as POINTER_PLUS_EXPR. + +2010-12-01 Sebastian Pop + * graphite-sese-to-poly.c (analyze_drs_in_stmts): Fix set but unused warning. (rewrite_cross_bb_scalar_deps_out_of_ssa): Same. diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index 8a5797e..b65e295 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -1698,7 +1698,7 @@ static tree interpret_rhs_expr (struct loop *loop, gimple at_stmt, tree type, tree rhs1, enum tree_code code, tree rhs2) { - tree res, chrec1, chrec2; + tree res, chrec1, chrec2, expr; if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS) { @@ -1715,12 +1715,27 @@ interpret_rhs_expr (struct loop *loop, gimple at_stmt, return chrec_convert (type, analyze_scalar_evolution (loop, rhs1), at_stmt); } - - return chrec_dont_know; } switch (code) { + case ADDR_EXPR: + /* Handle &MEM[ptr + CST] which is equivalent to POINTER_PLUS_EXPR. */ + if (TREE_CODE (TREE_OPERAND (rhs1, 0)) != MEM_REF) + { + res = chrec_dont_know; + break; + } + + expr = TREE_OPERAND (rhs1, 0); + rhs1 = TREE_OPERAND (expr, 0); + rhs2 = TREE_OPERAND (expr, 1); + type = TREE_TYPE (rhs1); + STRIP_USELESS_TYPE_CONVERSION (rhs1); + STRIP_USELESS_TYPE_CONVERSION (rhs2); + + /* Fall through. */ + case POINTER_PLUS_EXPR: chrec1 = analyze_scalar_evolution (loop, rhs1); chrec2 = analyze_scalar_evolution (loop, rhs2);