diff options
Diffstat (limited to 'gcc/tree-ssa-loop-split.cc')
-rw-r--r-- | gcc/tree-ssa-loop-split.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/tree-ssa-loop-split.cc b/gcc/tree-ssa-loop-split.cc index b41b5e6..f441f3f 100644 --- a/gcc/tree-ssa-loop-split.cc +++ b/gcc/tree-ssa-loop-split.cc @@ -540,10 +540,17 @@ split_loop (class loop *loop1) || !empty_block_p (loop1->latch) || !easy_exit_values (loop1) || !number_of_iterations_exit (loop1, exit1, &niter, false, true) - || niter.cmp == ERROR_MARK - /* We can't yet handle loops controlled by a != predicate. */ - || niter.cmp == NE_EXPR) + || niter.cmp == ERROR_MARK) return false; + if (niter.cmp == NE_EXPR) + { + if (!niter.control.no_overflow) + return false; + if (tree_int_cst_sign_bit (niter.control.step) > 0) + niter.cmp = GT_EXPR; + else + niter.cmp = LT_EXPR; + } bbs = get_loop_body (loop1); |