From patchwork Sun Jul 24 04:40:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 106505 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 541CEB6F77 for ; Sun, 24 Jul 2011 14:40:44 +1000 (EST) Received: (qmail 1223 invoked by alias); 24 Jul 2011 04:40:39 -0000 Received: (qmail 1102 invoked by uid 22791); 24 Jul 2011 04:40:37 -0000 X-SWARE-Spam-Status: No, hits=-2.6 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-yx0-f175.google.com (HELO mail-yx0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 24 Jul 2011 04:40:22 +0000 Received: by yxi19 with SMTP id 19so2125336yxi.20 for ; Sat, 23 Jul 2011 21:40:21 -0700 (PDT) Received: by 10.146.134.18 with SMTP id h18mr2904019yad.8.1311482421298; Sat, 23 Jul 2011 21:40:21 -0700 (PDT) Received: from napoca (adsl-99-184-92-236.dsl.austtx.sbcglobal.net [99.184.92.236]) by mx.google.com with ESMTPS id e21sm2105045ano.51.2011.07.23.21.40.19 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 23 Jul 2011 21:40:20 -0700 (PDT) Received: by napoca (sSMTP sendmail emulation); Sat, 23 Jul 2011 23:40:15 -0500 From: Sebastian Pop To: gcc-patches@gcc.gnu.org Cc: rguenther@suse.de, tobias@grosser.es, Sebastian Pop Subject: [PATCH] Fix PR47691: always run scev_const_prop before graphite Date: Sat, 23 Jul 2011 23:40:08 -0500 Message-Id: <1311482408-22717-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 This patch makes graphite run the scev_const_prop systematically even when using -fno-tree-scev-cprop. When scev_const_prop is not applied, there exist close_phi nodes for the main induction variable, making it impossible for graphite to distinguish between reductions and the IVs. So the main IV is translated as it was a reduction, i.e., using copies into temporary arrays, and that makes the scev analysis impossible during code generation. Bootstrapped and tested on amd64-linux. 2011-07-23 Sebastian Pop PR middle-end/47691 * graphite.c (graphite_initialize): Call scev_const_prop when flag_tree_scev_cprop is not set. * gfortran.dg/graphite/id-pr47691.f: New. --- gcc/ChangeLog | 6 ++++++ gcc/graphite.c | 3 +++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/graphite/id-pr47691.f | 7 +++++++ 4 files changed, 21 insertions(+), 0 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/graphite/id-pr47691.f diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9cfa21b..36347d6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-07-23 Sebastian Pop + + PR middle-end/47691 + * graphite.c (graphite_initialize): Call scev_const_prop when + flag_tree_scev_cprop is not set. + 2011-07-21 Sebastian Pop PR middle-end/47654 diff --git a/gcc/graphite.c b/gcc/graphite.c index b013447..dfe9ca7 100644 --- a/gcc/graphite.c +++ b/gcc/graphite.c @@ -201,6 +201,9 @@ graphite_initialize (void) return false; } + if (!flag_tree_scev_cprop) + scev_const_prop (); + scev_reset (); recompute_all_dominators (); initialize_original_copy_tables (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a63b647..5f9b79d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-07-23 Sebastian Pop + + PR middle-end/47691 + * gfortran.dg/graphite/id-pr47691.f: New. + 2011-07-21 Sebastian Pop PR middle-end/47654 diff --git a/gcc/testsuite/gfortran.dg/graphite/id-pr47691.f b/gcc/testsuite/gfortran.dg/graphite/id-pr47691.f new file mode 100644 index 0000000..0abbd55 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/id-pr47691.f @@ -0,0 +1,7 @@ +! { dg-options "-O -fgraphite-identity -ffast-math -fno-tree-scev-cprop" } + dimension b(12,8) + do i=1,norb + end do + b(i,j) = 0 + call rdrsym(b) + end