aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIra Rosen <ira.rosen@linaro.org>2011-03-29 10:26:25 +0000
committerIra Rosen <irar@gcc.gnu.org>2011-03-29 10:26:25 +0000
commit86c8d1f646594d65f8d78714e59c948aefe918ef (patch)
tree1a3d3096c8b418278ba50d4e654e2337694da920
parente8cf17e7e0267018019b71f24e979a355ae3a621 (diff)
downloadgcc-86c8d1f646594d65f8d78714e59c948aefe918ef.zip
gcc-86c8d1f646594d65f8d78714e59c948aefe918ef.tar.gz
gcc-86c8d1f646594d65f8d78714e59c948aefe918ef.tar.bz2
re PR tree-optimization/48290 (FAIL: gcc.dg/vect/pr38529.c, ICE in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1072)
PR tree-optimization/48290 * tree-vect-loop.c (vect_analyze_loop_operations): In outer loop vectorization, check that relevant phis in the basic block after the inner loop are really inner loop's exit phis. From-SVN: r171657
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/tree-vect-loop.c32
2 files changed, 36 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 323da28..ff341cf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2011-03-29 Ira Rosen <ira.rosen@linaro.org>
+
+ PR tree-optimization/48290
+ * tree-vect-loop.c (vect_analyze_loop_operations): In outer loop
+ vectorization, check that relevant phis in the basic block after
+ the inner loop are really inner loop's exit phis.
+
2011-03-29 Richard Sandiford <richard.sandiford@linaro.org>
PR debug/48190
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 690d9b7..5fecf2a 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -1184,11 +1184,11 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo)
print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM);
}
+ /* Inner-loop loop-closed exit phi in outer-loop vectorization
+ (i.e., a phi in the tail of the outer-loop). */
if (! is_loop_header_bb_p (bb))
{
- /* inner-loop loop-closed exit phi in outer-loop vectorization
- (i.e. a phi in the tail of the outer-loop).
- FORNOW: we currently don't support the case that these phis
+ /* FORNOW: we currently don't support the case that these phis
are not used in the outerloop (unless it is double reduction,
i.e., this phi is vect_reduction_def), cause this case
requires to actually do something here. */
@@ -1202,6 +1202,32 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo)
"Unsupported loop-closed phi in outer-loop.");
return false;
}
+
+ /* If PHI is used in the outer loop, we check that its operand
+ is defined in the inner loop. */
+ if (STMT_VINFO_RELEVANT_P (stmt_info))
+ {
+ tree phi_op;
+ gimple op_def_stmt;
+
+ if (gimple_phi_num_args (phi) != 1)
+ return false;
+
+ phi_op = PHI_ARG_DEF (phi, 0);
+ if (TREE_CODE (phi_op) != SSA_NAME)
+ return false;
+
+ op_def_stmt = SSA_NAME_DEF_STMT (phi_op);
+ if (!op_def_stmt || !vinfo_for_stmt (op_def_stmt))
+ return false;
+
+ if (STMT_VINFO_RELEVANT (vinfo_for_stmt (op_def_stmt))
+ != vect_used_in_outer
+ && STMT_VINFO_RELEVANT (vinfo_for_stmt (op_def_stmt))
+ != vect_used_in_outer_by_reduction)
+ return false;
+ }
+
continue;
}