test at top ==> test at bottom

max@nic.gac.edu (Max Hailperin)
Wed, 28 Apr 1993 19:15:10 GMT

          From comp.compilers

Related articles
test at top ==> test at bottom max@nic.gac.edu (1993-04-28)
Re: test at top ==> test at bottom preston@dawn.cs.rice.edu (1993-04-29)
Re: test at top ==> test at bottom marcoz@CS.CMU.EDU (1993-04-30)
Re: test at top ==> test at bottom tim@apple.com (1993-05-14)
| List of all articles for this month |

Newsgroups: comp.compilers
From: max@nic.gac.edu (Max Hailperin)
Keywords: optimize, question
Organization: Gustavus Adolphus College, St. Peter, MN
Date: Wed, 28 Apr 1993 19:15:10 GMT

While working my way through the literature on certain forms of loop
optimization, it occurred to me that I haven't seen much in the literature
on transformations that will turn test-at-the-top loops into
test-at-the-bottom loops. Yet unless you've done so, you can't safely
assume the loop will be done at least once.

I know some compilers may leave the loop structurally alone but prove
separately that it is done at least once, or may move some invariants out
of loops even without being sure that the loop is done at least once.
These aren't the approaches I'm interested in.

What I *am* interested in is approaches that literally transform the
structure of the loop. The basic approach seems to be to make two copies
of the test block (one for when the loop is initially entered, one for
subsequent iterations) and then try to optimize away the copy that is done
on the first iteration. This description leaves open all sorts of
questions about how to efficiently do it and how to avoid doing it where
it would involve replicating lots of code.

If you know of any good material on this topic, would you be so kind as to
send me a citation?


Post a followup to this message

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