From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Hayes To: Joern Rennecke Cc: m.hayes@elec.canterbury.ac.nz (Michael Hayes), amylaar@redhat.com (Joern Rennecke), jh@suse.cz (Jan Hubicka), gcc@gcc.gnu.org Subject: Re: Loop optimiser upgrade (Was RFC: BB duplication code) Date: Sun, 23 Sep 2001 04:29:00 -0000 Message-id: <15277.51117.553860.823311@ongaonga.elec.canterbury.ac.nz> References: <15275.62281.665389.608340@ongaonga.elec.canterbury.ac.nz> <200109220403.FAA29136@meolyon.local> X-SW-Source: 2001-09/msg00889.html 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.