https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85284
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- Ok, for conditional exit tests when the exit condition changes from false to true and _back_ we may not do this optimization since 'niter' expects this to be a one-way transition. Thus Index: gcc/tree-ssa-loop-niter.c =================================================================== --- gcc/tree-ssa-loop-niter.c (revision 259227) +++ gcc/tree-ssa-loop-niter.c (working copy) @@ -2356,11 +2356,11 @@ number_of_iterations_exit_assumptions (s tree iv0_niters = NULL_TREE; if (!simple_iv_with_niters (loop, loop_containing_stmt (stmt), - op0, &iv0, &iv0_niters, false)) + op0, &iv0, safe ? &iv0_niters : NULL, false)) return false; tree iv1_niters = NULL_TREE; if (!simple_iv_with_niters (loop, loop_containing_stmt (stmt), - op1, &iv1, &iv1_niters, false)) + op1, &iv1, safe ? &iv1_niters : NULL, false)) return false; /* Give up on complicated case. */ if (iv0_niters && iv1_niters)