diff options
author | matz <matz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-12-13 14:14:41 +0000 |
---|---|---|
committer | matz <matz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-12-13 14:14:41 +0000 |
commit | a1595d8324aee4159ff46480533cb59b3c7d1ca4 (patch) | |
tree | 9ade386320b09a0689eb2bf5b1cca6c2c902333a /gcc/tree-ssa-loop-split.c | |
parent | c6c892c59724ee788eb05567a998e0a46d156975 (diff) |
Fix pr78725
PR tree-optimization/78725
* tree-ssa-loop-split.c (split_at_bb_p): Check for overflow and
at correct use point.
testsuite/
PR tree-optimization/78725
* gcc.dg/pr78725.c: New test.
* gcc.dg/pr78725-2.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243606 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-split.c')
-rw-r--r-- | gcc/tree-ssa-loop-split.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c index dac68e6723a6..84c0627fb0b8 100644 --- a/gcc/tree-ssa-loop-split.c +++ b/gcc/tree-ssa-loop-split.c @@ -102,10 +102,11 @@ split_at_bb_p (struct loop *loop, basic_block bb, tree *border, affine_iv *iv) tree op0 = gimple_cond_lhs (stmt); tree op1 = gimple_cond_rhs (stmt); + struct loop *useloop = loop_containing_stmt (stmt); - if (!simple_iv (loop, loop, op0, iv, false)) + if (!simple_iv (loop, useloop, op0, iv, false)) return NULL_TREE; - if (!simple_iv (loop, loop, op1, &iv2, false)) + if (!simple_iv (loop, useloop, op1, &iv2, false)) return NULL_TREE; /* Make it so that the first argument of the condition is @@ -122,6 +123,8 @@ split_at_bb_p (struct loop *loop, basic_block bb, tree *border, affine_iv *iv) return NULL_TREE; if (!integer_zerop (iv2.step)) return NULL_TREE; + if (!iv->no_overflow) + return NULL_TREE; if (dump_file && (dump_flags & TDF_DETAILS)) { |