diff options
Diffstat (limited to 'gcc/tree-ssa-loop-ivcanon.c')
-rw-r--r-- | gcc/tree-ssa-loop-ivcanon.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c index 1a4d6df7062..9b59b4466c3 100644 --- a/gcc/tree-ssa-loop-ivcanon.c +++ b/gcc/tree-ssa-loop-ivcanon.c @@ -298,11 +298,17 @@ tree_estimate_loop_size (struct loop *loop, edge exit, edge edge_to_cancel, stru /* Conditionals. */ else if ((gimple_code (stmt) == GIMPLE_COND && constant_after_peeling (gimple_cond_lhs (stmt), stmt, loop) - && constant_after_peeling (gimple_cond_rhs (stmt), stmt, loop)) + && constant_after_peeling (gimple_cond_rhs (stmt), stmt, loop) + /* We don't simplify all constant compares so make sure + they are not both constant already. See PR70288. */ + && (! is_gimple_min_invariant (gimple_cond_lhs (stmt)) + || ! is_gimple_min_invariant (gimple_cond_rhs (stmt)))) || (gimple_code (stmt) == GIMPLE_SWITCH && constant_after_peeling (gimple_switch_index ( as_a <gswitch *> (stmt)), - stmt, loop))) + stmt, loop) + && ! is_gimple_min_invariant (gimple_switch_index ( + as_a <gswitch *> (stmt))))) { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, " Constant conditional.\n"); @@ -929,7 +935,7 @@ try_peel_loop (struct loop *loop, edge exit, tree niter, HOST_WIDE_INT maxiter) { - int npeel; + HOST_WIDE_INT npeel; struct loop_size size; int peeled_size; sbitmap wont_exit; @@ -984,7 +990,7 @@ try_peel_loop (struct loop *loop, { if (dump_file) fprintf (dump_file, "Not peeling: rolls too much " - "(%i + 1 > --param max-peel-times)\n", npeel); + "(%i + 1 > --param max-peel-times)\n", (int) npeel); return false; } npeel++; @@ -992,7 +998,7 @@ try_peel_loop (struct loop *loop, /* Check peeled loops size. */ tree_estimate_loop_size (loop, exit, NULL, &size, PARAM_VALUE (PARAM_MAX_PEELED_INSNS)); - if ((peeled_size = estimated_peeled_sequence_size (&size, npeel)) + if ((peeled_size = estimated_peeled_sequence_size (&size, (int) npeel)) > PARAM_VALUE (PARAM_MAX_PEELED_INSNS)) { if (dump_file) @@ -1026,7 +1032,7 @@ try_peel_loop (struct loop *loop, if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "Peeled loop %d, %i times.\n", - loop->num, npeel); + loop->num, (int) npeel); } if (loop->any_upper_bound) loop->nb_iterations_upper_bound -= npeel; |