Re: loops

wall@pa.dec.com (David Wall)
Wed, 26 Feb 92 21:11:25 GMT

          From comp.compilers

Related articles
Re: loops preston@dawn.cs.rice.edu (1992-02-25)
Re: loops mwolfe@ogicse.ogi.edu (1992-02-26)
Re: loops wall@pa.dec.com (1992-02-26)
Re: loops clc5q@hemlock.cs.Virginia.EDU (1992-02-28)
| List of all articles for this month |

Newsgroups: comp.compilers
From: wall@pa.dec.com (David Wall)
Keywords: optimize
Organization: DEC Palo Alto
References: <9202220021.AA28153@ucbvax.Berkeley.EDU> 92-02-113
Date: Wed, 26 Feb 92 21:11:25 GMT

Preston Briggs asks whether we should treat


do {
do {
<A>
} while ()
} while ()


as one loop or a nested pair.


Though intuition suggests that it is a pair, there is at least one
reason to treat it as one loop. Something like


while () {
switch () {
case foo:
...; break;
case bar:
...; break;
case baz:
...; break;
}


is otherwise very easy to mislabel as a triply-nested loop, if we
have already optimized the breaks into jumps back to the header.


When you run into a 100-ply switch statement that your compiler
calls a 100-deep nested loop, it really sticks with you, believe
me. Your hair -never- grows back.


David W. Wall - - - - - - - - - - - - - - - - wall@decwrl.dec.com
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.