------- Comment #5 from dorit at il dot ibm dot com 2007-02-19 14:12 ------- Looks like I wasn't careful enough with my fix for PR30771. Here is a fix for that fix I'm now testing:
Index: tree-vect-analyze.c =================================================================== --- tree-vect-analyze.c (revision 122128) +++ tree-vect-analyze.c (working copy) @@ -124,10 +124,11 @@ /* Two cases of "relevant" phis: those that define an induction that is used in the loop, and those that - define a reduction. */ + directly define a reduction. */ if ((STMT_VINFO_RELEVANT (stmt_info) == vect_used_in_loop && STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def) - || (STMT_VINFO_RELEVANT (stmt_info) == vect_used_by_reduction + || (STMT_VINFO_RELEVANT (stmt_info) == + vect_used_directly_by_reduction && STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def)) { gcc_assert (!STMT_VINFO_VECTYPE (stmt_info)); @@ -328,8 +329,12 @@ return false; } - if (STMT_VINFO_RELEVANT (stmt_info) == vect_used_in_loop - && STMT_VINFO_DEF_TYPE (stmt_info) != vect_induction_def) + if ((STMT_VINFO_RELEVANT (stmt_info) == vect_used_in_loop + && STMT_VINFO_DEF_TYPE (stmt_info) != vect_induction_def) + || (STMT_VINFO_RELEVANT (stmt_info) > + vect_used_directly_by_reduction + && STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def)) + { /* Most likely a reduction-like computation that is used in the loop. */ @@ -2313,9 +2318,11 @@ if (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def) { gcc_assert (relevant == vect_unused_in_loop && live_p); - relevant = vect_used_by_reduction; + relevant = vect_used_directly_by_reduction; live_p = false; } + else if (relevant == vect_used_directly_by_reduction) + relevant = vect_used_by_reduction; i = 0; FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE) Index: tree-vectorizer.h =================================================================== --- tree-vectorizer.h (revision 122128) +++ tree-vectorizer.h (working copy) @@ -175,6 +175,7 @@ /* Indicates whether/how a variable is used in the loop. */ enum vect_relevant { vect_unused_in_loop = 0, + vect_used_directly_by_reduction, vect_used_by_reduction, vect_used_in_loop }; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30858