On Fri, 16 Sep 2016, Richard Biener wrote:
> We don't -- I guess it would be an interesting transform but difficult
> in this case as gimple_get_lhs might have side-effects we cannot skip.
If there are side-effects it's anyway not going to be very profitable.
loop-splitting is mostly an enabler for vectorization; loops with
side-effects don't vectorize (as of now).
> It might fit loop splitting which would split it "dynamically" into a
> head running until we set found to true, skipping to the tail that has
> the loop with omitted guard and found = true setting. If the loop ends
> up with no side-effects it should end up being removed. If not it might
> actually not be a desirable transform due to code-size.
Yes, such transformation would be possible. If the loop has no
other side-effects than setting LCSSA names to a single value then the
second loop wouldn't even be necessary (i.e. the "break" would essentially
be inserted). For this specific case it indeed looks like the loop
splitting routines could be reasonably be used.