public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sebastian Pop <sebpop@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: gcc-graphite@googlegroups.com,	Sebastian Pop <sebpop@gmail.com>
Subject: [PATCH 11/12] Do not rewrite out of SSA scalar phi nodes that can be scev_analyzable_p.
Date: Fri, 16 Jul 2010 07:05:00 -0000	[thread overview]
Message-ID: <1279263843-9149-12-git-send-email-sebpop@gmail.com> (raw)
In-Reply-To: <1279263843-9149-1-git-send-email-sebpop@gmail.com>

2010-07-15  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-sese-to-poly.c (reduction_phi_p): Do not rewrite out of
	SSA scalar phi nodes that can be scev_analyzable_p.

	* gfortran.dg/graphite/id-20.f: Adjust testcase.
---
 gcc/ChangeLog.graphite                     |    7 +++++++
 gcc/graphite-sese-to-poly.c                |   20 ++++----------------
 gcc/testsuite/gfortran.dg/graphite/id-20.f |   12 +++++++++---
 3 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 8230d31..6600df7 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,12 @@
 2010-07-15  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* graphite-sese-to-poly.c (reduction_phi_p): Do not rewrite out of
+	SSA scalar phi nodes that can be scev_analyzable_p.
+
+	* gfortran.dg/graphite/id-20.f: Adjust testcase.
+
+2010-07-15  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): Correctly
 	handle SSA_NAME_IS_DEFAULT_DEF.
 
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 3d903d3..c08a4f2 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -165,8 +165,6 @@ static bool
 reduction_phi_p (sese region, gimple_stmt_iterator *psi)
 {
   loop_p loop;
-  tree scev;
-  affine_iv iv;
   gimple phi = gsi_stmt (*psi);
   tree res = gimple_phi_result (phi);
 
@@ -189,11 +187,11 @@ reduction_phi_p (sese region, gimple_stmt_iterator *psi)
       return false;
     }
 
-  /* Main induction variables with constant strides in LOOP are not
-     reductions.  */
-  if (simple_iv (loop, loop, res, &iv, true))
+  if (scev_analyzable_p (res, region))
     {
-      if (integer_zerop (iv.step))
+      tree scev = scalar_evolution_in_region (region, loop, res);
+
+      if (evolution_function_is_invariant_p (scev, loop->num))
 	remove_invariant_phi (region, psi);
       else
 	gsi_next (psi);
@@ -201,16 +199,6 @@ reduction_phi_p (sese region, gimple_stmt_iterator *psi)
       return false;
     }
 
-  scev = scalar_evolution_in_region (region, loop, res);
-  if (chrec_contains_undetermined (scev))
-    return true;
-
-  if (evolution_function_is_invariant_p (scev, loop->num))
-    {
-      remove_invariant_phi (region, psi);
-      return false;
-    }
-
   /* All the other cases are considered reductions.  */
   return true;
 }
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-20.f b/gcc/testsuite/gfortran.dg/graphite/id-20.f
index 110ae3f..795cb1b 100644
--- a/gcc/testsuite/gfortran.dg/graphite/id-20.f
+++ b/gcc/testsuite/gfortran.dg/graphite/id-20.f
@@ -1,4 +1,10 @@
-      DO 32 MB=1,NVIRA
-     *                     PVIRA(MA,MB)*(EA(MA+NOA)+EA(MB+NOA))*PT5
-   32 CONTINUE
+! { dg-options "-O3 -ffast-math" }
+
+      DIMENSION FPQR(25,25,25)
+      INTEGER P,Q,R
+            DO 130 R=1,N4MAX,2
+               IF(P.GT.1) THEN
+                  FPQR(P,Q,R)= RM2*FPQR(P,Q,R-2)*REC(P+Q+R-2)
+               END IF
+  130       RM2= RM2+TWO
       END
-- 
1.7.0.4

  parent reply	other threads:[~2010-07-16  7:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-16  7:04 [PATCH 00/12] [graphite] Remove the induction variable canonicalization Sebastian Pop
2010-07-16  7:04 ` [PATCH 03/12] chrec_apply should only apply to the specified variable Sebastian Pop
2010-07-16  7:04 ` [PATCH 07/12] Scevs could be expressions without chrecs and still be scev_analyzable_p Sebastian Pop
2010-07-16  7:04 ` [PATCH 09/12] Add testcase for PR42729 and fix handling of gimple_debug info Sebastian Pop
2010-07-16  7:05 ` [PATCH 01/12] Remove insert_loop_close_phis Sebastian Pop
2010-07-16  7:05 ` [PATCH 12/12] Unshare the scev before code generating it Sebastian Pop
2010-07-16  7:05 ` [PATCH 08/12] Special case non close-phi nodes with one argument in rewrite_close_phi_out_of_ssa Sebastian Pop
2010-07-16  7:05 ` [PATCH 05/12] Remove uses of loop->single_iv Sebastian Pop
2010-07-16  7:05 ` Sebastian Pop [this message]
2010-07-16  7:05 ` [PATCH 04/12] Also handle GIMPLE_CALLs in rewrite_cross_bb_scalar_deps Sebastian Pop
2010-07-16  7:05 ` [PATCH 02/12] Remove expand_scalar_variables_ hack Sebastian Pop
2010-07-16  7:05 ` [PATCH 06/12] Bump the size of scevs Sebastian Pop
2010-07-16  8:03   ` Richard Guenther
2010-07-16 14:41     ` Sebastian Pop
2010-07-16  7:05 ` [PATCH 10/12] Correctly handle SSA_NAME_IS_DEFAULT_DEF in rewrite_close_phi_out_of_ssa Sebastian Pop

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1279263843-9149-12-git-send-email-sebpop@gmail.com \
    --to=sebpop@gmail.com \
    --cc=gcc-graphite@googlegroups.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).