aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2009-12-15 15:17:46 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2009-12-15 15:17:46 +0000
commit0596e97f1c045f73b5ce65f85e5a20fc5e728392 (patch)
tree10039beb55c068a2e7c2ed3a603b42ebdc4214c6
parent3efd49f9dfe125830c71d8f52a65ced5180dad88 (diff)
downloadgcc-0596e97f1c045f73b5ce65f85e5a20fc5e728392.zip
gcc-0596e97f1c045f73b5ce65f85e5a20fc5e728392.tar.gz
gcc-0596e97f1c045f73b5ce65f85e5a20fc5e728392.tar.bz2
re PR tree-optimization/42185 ([graphite] expected gimple_assign(error_mark), have gimple_call() in gimple_assign_rhs_code, at gimple.h:1820)
PR graphite/42185 * graphite-sese-to-poly.c (is_reduction_operation_p): Assert that we are a GIMPLE_ASSIGN. Do not calculate rhs code twice. (follow_ssa_with_commutative_ops): Return NULL on non assignment. From-SVN: r155256
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/graphite-sese-to-poly.c12
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/pr42185.f9027
3 files changed, 44 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index aaf4a1e..6259415 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2009-12-15 Aldy Hernandez <aldyh@redhat.com>
+
+ PR graphite/42185
+ * graphite-sese-to-poly.c (is_reduction_operation_p): Assert that
+ we are a GIMPLE_ASSIGN. Do not calculate rhs code twice.
+ (follow_ssa_with_commutative_ops): Return NULL on non assignment.
+
2009-12-15 Eric Botcazou <ebotcazou@adacore.com>
* config/rs6000/rs6000.md (probe_stack): Use an enclosing SET.
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 1eb0696..370bbff 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -2462,9 +2462,14 @@ split_reduction_stmt (gimple stmt)
static inline bool
is_reduction_operation_p (gimple stmt)
{
+ enum tree_code code;
+
+ gcc_assert (is_gimple_assign (stmt));
+ code = gimple_assign_rhs_code (stmt);
+
return flag_associative_math
- && commutative_tree_code (gimple_assign_rhs_code (stmt))
- && associative_tree_code (gimple_assign_rhs_code (stmt));
+ && commutative_tree_code (code)
+ && associative_tree_code (code);
}
/* Returns true when PHI contains an argument ARG. */
@@ -2500,6 +2505,9 @@ follow_ssa_with_commutative_ops (tree arg, tree lhs)
return NULL;
}
+ if (!is_gimple_assign (stmt))
+ return NULL;
+
if (gimple_num_ops (stmt) == 2)
return follow_ssa_with_commutative_ops (gimple_assign_rhs1 (stmt), lhs);
diff --git a/gcc/testsuite/gfortran.dg/graphite/pr42185.f90 b/gcc/testsuite/gfortran.dg/graphite/pr42185.f90
new file mode 100644
index 0000000..0918f72
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/pr42185.f90
@@ -0,0 +1,27 @@
+! { dg-compile }
+! { dg-options "-fgraphite -O -ffast-math" }
+
+MODULE powell
+ INTEGER, PARAMETER :: dp=8
+CONTAINS
+ SUBROUTINE trsapp (n,npt,xopt,xpt,gq,hq,pq,delta,step,d,g,hd,hs,crvmin)
+ REAL(dp), DIMENSION(*), INTENT(INOUT) :: step, d, g, hd, hs
+ LOGICAL :: jump1, jump2
+ REAL(dp) :: alpha, angle, angtest, bstep, cf, cth, dd, delsq, dg, dhd, &
+ reduc, sg, sgk, shs, ss, sth, temp, tempa, tempb
+ DO i=1,n
+ dd=dd+d(i)**2
+ END DO
+ mainloop : DO
+ IF ( .NOT. jump2 ) THEN
+ IF ( .NOT. jump1 ) THEN
+ bstep=temp/(ds+SQRT(ds*ds+dd*temp))
+ IF (alpha < bstep) THEN
+ IF (ss < delsq) CYCLE mainloop
+ END IF
+ IF (gg <= 1.0e-4_dp*ggbeg) EXIT mainloop
+ END IF
+ END IF
+ END DO mainloop
+ END SUBROUTINE trsapp
+END MODULE powell