Re: Unrolling and spilling

"cr88192" <>
Fri, 30 Jan 2009 06:41:08 +1000

          From comp.compilers

Related articles
Unrolling and spilling (Stephan Ceram) (2009-01-28)
Re: Unrolling and spilling (Sid Touati) (2009-01-29)
Re: Unrolling and spilling (Harold Aptroot) (2009-01-29)
Re: Unrolling and spilling (cr88192) (2009-01-30)
Re: Unrolling and spilling (Carlie Coats) (2009-05-23)
| List of all articles for this month |

From: "cr88192" <>
Newsgroups: comp.compilers
Date: Fri, 30 Jan 2009 06:41:08 +1000
References: 09-01-058
Keywords: optimize, registers
Posted-Date: 29 Jan 2009 19:48:46 EST

"Stephan Ceram" <> wrote in message
> In many compiler books and papers you read that loop unrolling
> possibly increases register pressure that leads to extra spill code. I
> don't see the reason how this can happen. When you perform unrolling
> at assembly level, the loop bodies are just replicated, so the
> register life ranges are not really increased. Also, when unrolling is
> done at the source code, I don't really see a reason why the register
> allocation should add more spill instructions. More spilling would
> mean that you have a change in the life ranges of the variables that
> adversely influenced the interference graph. But why should I get
> more conflicting life ranges after unrolling?
> The only reason I see are instruction scheduling techniques that might
> mix up life ranges but the literature does not mention these
> optimizations in context of spilling and unrolling.

I wrote a compiler and I don't see why this should be the case...

any spilling that would occur as a result of unrolling I would think would
also occur as a result of having had the loop.

but, then again, I also wrote a fairly stupid compiler, which tends to spill
its registers whenever running across a label or jump (the register
allocator/... is stupid, and so will not bother to take control flow and
similar into account, but will rather just spill any registers in order to
make sure everything is in a consistent state prior to either entering the
label, or initiating the jump).

so, in my case, unrolling would actually help, as since there is no longer a
need for labels and conditional jumps (resulting from the looping code), it
may be able to avoid spilling registers...

then again, I didn't read any of the existing literature prior to originally
writing my compiler, rather I just used the powers of past experience and
programmer intuition.

or such...

Post a followup to this message

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