https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119999

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It stopped aborting with r14-2709-g65ff4a45b11b5ab13ef849bd5721ab28ff316202

Author:     Jan Hubicka
AuthorDate: Fri Jul 21 13:54:23 2023

    loop-ch improvements, part 5

    Currently loop-ch skips all do-while loops.  But when loop is not do-while
    in addition to original goal of turining it to do-while it can do
additional
    things:
     1) move out loop invariant computations
     2) duplicate loop invariant conditionals and eliminate them in loop body.
     3) prove that some exits are always true in first iteration
        and can be skipped

    Most of time 1 can be done by lim (exception is when the invariant
computation
    is conditional). For 2 we however don't really have other place doing it
except
    for loop unswitching that is more expensive (it will duplicate the loop and
    then optimize out one path to non-loop).
    3 can be done by loop peeling but it is also more expensive by duplicating
full
    loop body.

    This patch improves heuristics by not giving up on do-while loops and
trying
    to find sequence of BBs to duplicate to obtain one of goals:
     - turn loop to do-while
     - eliminate invariant conditional in loop body
     - do partial "peeling" as long as code optimizes enough so this does not
       increase code size.

Reply via email to