PR graphite/42185

Aldy Hernandez aldyh@redhat.com
Mon Dec 14 17:36:00 GMT 2009


We're calling is_reduction_operation_p() with the result from
SSA_NAME_DEF_STMT, but we're incorrectly assuming that only
GIMPLE_ASSIGNs are returned.  An SSA definition can also be a GIMPLE_CALL
with an LHS, or a GIMPLE_NOP.  Plus, I doubt a GIMPLE_CALL or a NOP are
reduction operations :).

Fixed thusly.

BTW, there are two independent testcases on this PR.  This patch fixes
both, but uncovers an unrelated SSA verification bug in the second one.

OK for trunk?

	PR graphite/42185
	* graphite-sese-to-poly.c (is_reduction_operation_p): Exit if stmt
	is not a GIMPLE_ASSIGN.

Index: graphite-sese-to-poly.c
===================================================================
--- graphite-sese-to-poly.c	(revision 155214)
+++ graphite-sese-to-poly.c	(working copy)
@@ -2458,6 +2458,9 @@ split_reduction_stmt (gimple stmt)
 static inline bool
 is_reduction_operation_p (gimple stmt)
 {
+  if (!is_gimple_assign (stmt))
+    return false;
+
   return flag_associative_math
     && commutative_tree_code (gimple_assign_rhs_code (stmt))
     && associative_tree_code (gimple_assign_rhs_code (stmt));



More information about the Gcc-patches mailing list