Re: Unrolling and spilling

Sid Touati <>
Thu, 29 Jan 2009 13:21:50 +0100

          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: Sid Touati <>
Newsgroups: comp.compilers
Date: Thu, 29 Jan 2009 13:21:50 +0100
Organization: INRIA Rocquencourt
References: 09-01-058
Keywords: optimize, registers
Posted-Date: 29 Jan 2009 19:47:45 EST

Stephan Ceram a icrit :
> 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.

Your are right, there is no reason that loop unrolling increases the
register pressure if no instruction scheduling is applied afterwards.

The register pressure may increase after loop unrolling if instruction
scheduling is applied afterwards. If the instruction scheduler is
aggressive, then the register pressure (MAXLIVE) may increase, because
more instructions are scheduled, so more lifetime intervals may be in
conflict. If no care is taken, additional spill code may be introduced.

Bounding and/or analysing register pressure before instruction
scheduling is done using the register saturation concept. The following
article studies the relationship between loop unrolling and register
pressure increase:

Sid-Ahmed-Ali Touati. Register Saturation in Instruction Level
Parallelism. International Journal of Parallel Programming,
Springer-Verlag, Volume 33, Issue 4, August 2005. 57 pages.

Post a followup to this message

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