|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 email@example.com (Harold Aptroot) (2009-01-29)|
|Re: Unrolling and spilling firstname.lastname@example.org (cr88192) (2009-01-30)|
|Re: Unrolling and spilling email@example.com (Carlie Coats) (2009-05-23)|
|From:||"Harold Aptroot" <firstname.lastname@example.org>|
|Date:||Thu, 29 Jan 2009 15:53:44 +0100|
|Organization:||A noiseless patient Spider|
|Posted-Date:||29 Jan 2009 19:48:19 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.
> 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.
Instruction scheduling is a very important optimization for pipelined
processors, they really should have mentioned how it affects
Software pipelining is a good example that combines scheduling with
Anyway, when an array is accessed in the loop body, and it reads back from
the same array a few iterations after it had written that entry, unrolling
could cause the compiler to keep the value in a register (staying live
across the boundaries of the copies of the loop bodies), adding to the
pressure. I don't expect that to be overly common, but it's at least one
example of how unrolling could increase register pressure - but again it
only occurs in combination with other optimizations.
Some compilers may also be tricked by their own unrolling to think that the
index variable (loop counter) is hotter and therefore decide not to split
its live range, but that wouldn't be very clever of them. It could happen
though, heuristics for the hot-ness of variables are hard to get right,
especially for loops of which the length can not be determined at
This is the only example I can think of at the moment that will cause plain
unrolling (no reordering or caching of array elements etc) to affect
register pressure - which doesn't mean that there are no other ways.
Return to the
Search the comp.compilers archives again.