Loop optimiser upgrade (Was RFC: BB duplication code)

Michael Hayes m.hayes@elec.canterbury.ac.nz
Sun Sep 23 04:29:00 GMT 2001


Joern Rennecke writes:
 > > My question is how do we tell this from a do-while loop with a goto
 > > around it?
 > 
 > You don't - and it's immaterial for the purpose of spotting loops that are
 > executed at least once if entered.  That's a property all do-wile loops
 > have, by definition.

Sure!   I guess I didn't explain myself well or you missed my point.  

The advantage of knowing that the loop exit test has been duplicated
is that when one of these transformed loops is entered we know that
the exit test will be true on the first iteration.  This allows us to
compute the number (or maximum number) of iterations of well behaved
loops without having do perform value range propagation.

The point I was trying to make is that I do not know of a simple,
general, way of looking at the CFG to see if the loop exit has been
duplicated.  I cannot see how your suggestion that there may be a
fall-through edge into the loop header will tell us this since
I can construct an equivalent CFG using a goto.

Michael.





More information about the Gcc mailing list