|Unrolling and spilling linuxkaffee_@_gmx.net (Stephan Ceram) (2009-01-28)|
|Re: Unrolling and spilling SidTouati@inria.fr (Sid Touati) (2009-01-29)|
|Re: Unrolling and spilling firstname.lastname@example.org (Harold Aptroot) (2009-01-29)|
|Re: Unrolling and spilling email@example.com (cr88192) (2009-01-30)|
|Re: Unrolling and spilling firstname.lastname@example.org (Carlie Coats) (2009-05-23)|
|Date:||Fri, 30 Jan 2009 06:41:08 +1000|
|Posted-Date:||29 Jan 2009 19:48:46 EST|
"Stephan Ceram" <linuxkaffee_@_gmx.net> 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
Return to the
Search the comp.compilers archives again.