Re: Spill code and unrolling

Walter Banks <>
Mon, 15 Dec 2008 10:03:36 -0500

          From comp.compilers

Related articles
Spill code and unrolling (Stephan Ceram) (2008-12-11)
Re: Spill code and unrolling (Sid Touati) (2008-12-12)
Re: Spill code and unrolling (Giridhar S) (2008-12-13)
Re: Spill code and unrolling (Walter Banks) (2008-12-15)
| List of all articles for this month |

From: Walter Banks <>
Newsgroups: comp.compilers
Date: Mon, 15 Dec 2008 10:03:36 -0500
Organization: Compilers Central
References: 08-12-067
Keywords: optimize
Posted-Date: 15 Dec 2008 12:44:39 EST

Stephan Ceram wrote:

> I've a question about loop unrolling. Let's assume that you compile
> your program without loop unrolling in advance to check if the loops
> which are candidates for loop unrolling contain any spill code. If so,
> it is very likely that after loop unrolling the contained spill code
> is duplicated by the number of how often this loop is unrolled.
> Now, I was wondering if it would be a good heuristic for a loop
> unroller to skip loops containing spill code. What do you think? Is it
> still useful to unroll such loops (since the positive effects of
> unrolling will overbalance) or will the additional spill code probably
> decrease the total program execution time (or just negligibly improve
> it), thus unrolling of these loops should be omitted?


There is one question that hasn't been a part of the mix about loop
unrolling. Loop unrolling that trades code size for execution speed
needs to consider the programmer's intent. (There are cases where the
optimization is a clear win)

In the embedded systems compilers we develop we stopped doing any loop
rolling and unrolling because most of the developers using our
compilers will naturally unroll loops when execution time is important
and roll up loops when it is not.

This is an optimization that seems to benefit most from badly written
code for our customers.

All the best of the season
Walter Banks
Byte Craft Limited
[Where's the FREQUENCY statement when you need it? -John]


Post a followup to this message

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