[llvm-commits] X86 FastISel: Emit immediate call arguments locally to save stack size when compiling with -O0

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu Aug 11 10:20:11 PDT 2011


On Aug 11, 2011, at 10:06 AM, Ivan Krasin wrote:

> On Thu, Aug 11, 2011 at 9:50 AM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
>> I don't understand how your patch can increase the stack space used. How does that happen? What is getting spilled?
> Fast register allocator is too stupid.
> 
> This is the code that allocates so much stack:
>        movq    %rdx, 816(%rsp)
>        movq    %rcx, %rdx
>        movq    816(%rsp), %r8
> 
> As you can see, it's equivalent of
> movq %rdx, %r8
> movq %rcx, %rdx

Yep, RAFast will spill when it gets in trouble. I guess I don't understand why your patch would cause it to get in trouble. Is it because the constants are not materialized immediately before they are used?

> Ok, it's stupid, but it could (at least) use the same stack slot for
> these things! But fast regalloc does not use live intervals, so it
> can't decide to reuse stack slots w/o an improvement.
> Probably, fast regalloc should be improved as well. In this case, my
> patch would not have regressions for stack size.

Please file a PR for that.

A primitive form of stack slot coloring would be to reuse stack slots for spilled local live ranges.

RAFast doesn't actually know which live ranges are local until it has assigned the last use, but perhaps that could be improved.

/jakob




More information about the llvm-commits mailing list