diff options
author | Michael Matz <matz@suse.de> | 2016-12-13 14:14:41 +0000 |
---|---|---|
committer | Michael Matz <matz@gcc.gnu.org> | 2016-12-13 14:14:41 +0000 |
commit | 9042295c44dad698b9f9758c79185879511e8dee (patch) | |
tree | 9ade386320b09a0689eb2bf5b1cca6c2c902333a /gcc/tree-ssa-loop-split.c | |
parent | 5594a028feb4b97996bd93efae74eec9a4295303 (diff) | |
download | gcc-9042295c44dad698b9f9758c79185879511e8dee.zip gcc-9042295c44dad698b9f9758c79185879511e8dee.tar.gz gcc-9042295c44dad698b9f9758c79185879511e8dee.tar.bz2 |
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.
From-SVN: r243606
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 dac68e6..84c0627 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)) { |