diff options
author | Bin Cheng <bin.cheng@arm.com> | 2016-05-19 09:03:36 +0000 |
---|---|---|
committer | Bin Cheng <bin.cheng@arm.com> | 2016-05-19 09:03:36 +0000 |
commit | 714bb35eeef3dbdc6ec7d38a84a5c302ff1abde0 (patch) | |
tree | ed0749d933bf5830fe927bf80ef9f5d93cf0c72c | |
parent | d1188e1803d9d97c4ef2aade6d729e53339a4527 (diff) |
PR tree-optimization/69848
* tree-vect-loop.c (vectorizable_reduction): Don't factor
comparison expr out of VEC_COND_EXPR for COND_REDUCTION.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@236447 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/tree-vect-loop.c | 17 |
2 files changed, 11 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e2e29fe5d48..b39357a002c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-05-19 Bin Cheng <bin.cheng@arm.com> + + PR tree-optimization/69848 + * tree-vect-loop.c (vectorizable_reduction): Don't factor + comparison expr out of VEC_COND_EXPR for COND_REDUCTION. + 2016-05-19 Segher Boessenkool <segher@kernel.crashing.org> * function.c (thread_prologue_and_epilogue_insn): Move the diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index d673c67b4a0..67053af3246 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -6159,21 +6159,14 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, Finally, we update the phi (NEW_PHI_TREE) to take the value of the new cond_expr (INDEX_COND_EXPR). */ - /* Turn the condition from vec_stmt into an ssa name. */ - gimple_stmt_iterator vec_stmt_gsi = gsi_for_stmt (*vec_stmt); - tree ccompare = gimple_assign_rhs1 (*vec_stmt); - tree ccompare_name = make_ssa_name (TREE_TYPE (ccompare)); - gimple *ccompare_stmt = gimple_build_assign (ccompare_name, - ccompare); - gsi_insert_before (&vec_stmt_gsi, ccompare_stmt, GSI_SAME_STMT); - gimple_assign_set_rhs1 (*vec_stmt, ccompare_name); - update_stmt (*vec_stmt); + /* Duplicate the condition from vec_stmt. */ + tree ccompare = unshare_expr (gimple_assign_rhs1 (*vec_stmt)); /* Create a conditional, where the condition is taken from vec_stmt - (CCOMPARE_NAME), then is the induction index (INDEX_BEFORE_INCR) - and else is the phi (NEW_PHI_TREE). */ + (CCOMPARE), then is the induction index (INDEX_BEFORE_INCR) and + else is the phi (NEW_PHI_TREE). */ tree index_cond_expr = build3 (VEC_COND_EXPR, cr_index_vector_type, - ccompare_name, indx_before_incr, + ccompare, indx_before_incr, new_phi_tree); cond_name = make_ssa_name (cr_index_vector_type); gimple *index_condition = gimple_build_assign (cond_name, |