summaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-05 14:16:51 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-05 14:16:51 +0000
commiteda71dfb747ceaed86aaaedc2b1b250f34c84fb7 (patch)
tree027bb3c25e6b6492fffec670c48fdbb7c9fa1f20 /gcc/tree-if-conv.c
parent22d90df9fe5ab783be6907aaeea2d5e0a95c32d1 (diff)
downloadgcc-eda71dfb747ceaed86aaaedc2b1b250f34c84fb7.tar.gz
2015-08-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/67121 * tree-if-conv.c (combine_blocks): Clear range-info produced by stmts no longer executed conditionally. * gcc.dg/torture/pr67121.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226630 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-if-conv.c')
-rw-r--r--gcc/tree-if-conv.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index b5de1b2cdb6..291e6020b25 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -2199,9 +2199,11 @@ combine_blocks (struct loop *loop, bool any_mask_load_store)
/* Merge basic blocks: first remove all the edges in the loop,
except for those from the exit block. */
exit_bb = NULL;
+ bool *predicated = XNEWVEC (bool, orig_loop_num_nodes);
for (i = 0; i < orig_loop_num_nodes; i++)
{
bb = ifc_bbs[i];
+ predicated[i] = !is_true_predicate (bb_predicate (bb));
free_bb_predicate (bb);
if (bb_with_exit_edge_p (loop, bb))
{
@@ -2259,9 +2261,21 @@ combine_blocks (struct loop *loop, bool any_mask_load_store)
if (bb == exit_bb || bb == loop->latch)
continue;
- /* Make stmts member of loop->header. */
+ /* Make stmts member of loop->header and clear range info from all stmts
+ in BB which is now no longer executed conditional on a predicate we
+ could have derived it from. */
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- gimple_set_bb (gsi_stmt (gsi), merge_target_bb);
+ {
+ gimple stmt = gsi_stmt (gsi);
+ gimple_set_bb (stmt, merge_target_bb);
+ if (predicated[i])
+ {
+ ssa_op_iter i;
+ tree op;
+ FOR_EACH_SSA_TREE_OPERAND (op, stmt, i, SSA_OP_DEF)
+ reset_flow_sensitive_info (op);
+ }
+ }
/* Update stmt list. */
last = gsi_last_bb (merge_target_bb);
@@ -2281,6 +2295,7 @@ combine_blocks (struct loop *loop, bool any_mask_load_store)
free (ifc_bbs);
ifc_bbs = NULL;
+ free (predicated);
}
/* Version LOOP before if-converting it; the original loop