aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-slp.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2013-01-31 16:52:28 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2013-01-31 16:52:28 +0000
commite44978dcc76c928a85de87bebed33a7ab5609571 (patch)
tree061022a78dd78325d70e31b1a17238815064417f /gcc/tree-vect-slp.c
parent422e2fc06270497c479de0da7408158cc5e31c9a (diff)
downloadgcc-e44978dcc76c928a85de87bebed33a7ab5609571.zip
gcc-e44978dcc76c928a85de87bebed33a7ab5609571.tar.gz
gcc-e44978dcc76c928a85de87bebed33a7ab5609571.tar.bz2
re PR tree-optimization/56157 (ICE with -ftree-vectorize in in compute_live_loop_exits)
2013-01-31 Richard Biener <rguenther@suse.de> PR tree-optimization/56157 * tree-vect-slp.c (vect_get_slp_defs): More thoroughly try to match up operand with SLP child. * gcc.dg/torture/pr56157.c: New testcase. From-SVN: r195616
Diffstat (limited to 'gcc/tree-vect-slp.c')
-rw-r--r--gcc/tree-vect-slp.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 941661e..36f8129 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -2616,13 +2616,13 @@ void
vect_get_slp_defs (vec<tree> ops, slp_tree slp_node,
vec<slp_void_p> *vec_oprnds, int reduc_index)
{
- gimple first_stmt, first_def;
+ gimple first_stmt;
int number_of_vects = 0, i;
unsigned int child_index = 0;
HOST_WIDE_INT lhs_size_unit, rhs_size_unit;
slp_tree child = NULL;
vec<tree> *vec_defs;
- tree oprnd, def_lhs;
+ tree oprnd;
bool vectorized_defs;
first_stmt = SLP_TREE_SCALAR_STMTS (slp_node)[0];
@@ -2638,29 +2638,22 @@ vect_get_slp_defs (vec<tree> ops, slp_tree slp_node,
if (SLP_TREE_CHILDREN (slp_node).length () > child_index)
{
child = (slp_tree) SLP_TREE_CHILDREN (slp_node)[child_index];
- first_def = SLP_TREE_SCALAR_STMTS (child)[0];
-
- /* In the end of a pattern sequence we have a use of the original stmt,
- so we need to compare OPRND with the original def. */
- if (is_pattern_stmt_p (vinfo_for_stmt (first_def))
- && !STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (first_stmt))
- && !is_pattern_stmt_p (vinfo_for_stmt (first_stmt)))
- first_def = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (first_def));
- if (is_gimple_call (first_def))
- def_lhs = gimple_call_lhs (first_def);
- else
- def_lhs = gimple_assign_lhs (first_def);
+ /* We have to check both pattern and original def, if available. */
+ gimple first_def = SLP_TREE_SCALAR_STMTS (child)[0];
+ gimple related = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (first_def));
- if (operand_equal_p (oprnd, def_lhs, 0))
- {
- /* The number of vector defs is determined by the number of
- vector statements in the node from which we get those
+ if (operand_equal_p (oprnd, gimple_get_lhs (first_def), 0)
+ || (related
+ && operand_equal_p (oprnd, gimple_get_lhs (related), 0)))
+ {
+ /* The number of vector defs is determined by the number of
+ vector statements in the node from which we get those
statements. */
- number_of_vects = SLP_TREE_NUMBER_OF_VEC_STMTS (child);
- vectorized_defs = true;
+ number_of_vects = SLP_TREE_NUMBER_OF_VEC_STMTS (child);
+ vectorized_defs = true;
child_index++;
- }
+ }
}
if (!vectorized_defs)