aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-if-conv.c')
-rw-r--r--gcc/tree-if-conv.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 36a879d..98962c2 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -1407,7 +1407,8 @@ is_cond_scalar_reduction (gimple phi, gimple *reduc,
gimple stmt;
gimple header_phi = NULL;
enum tree_code reduction_op;
- struct loop *loop = gimple_bb (phi)->loop_father;
+ basic_block bb = gimple_bb (phi);
+ struct loop *loop = bb->loop_father;
edge latch_e = loop_latch_edge (loop);
imm_use_iterator imm_iter;
use_operand_p use_p;
@@ -1447,6 +1448,11 @@ is_cond_scalar_reduction (gimple phi, gimple *reduc,
if (!is_predicated (gimple_bb (stmt)))
return false;
+ /* Check that stmt-block is predecessor of phi-block. */
+ if (EDGE_PRED (bb, 0)->src != gimple_bb (stmt)
+ && EDGE_PRED (bb, 1)->src != gimple_bb (stmt))
+ return false;
+
if (!has_single_use (lhs))
return false;