[LLVMdev] Excessive register spilling in large automatically generated functions, such as is found in FFTW

Anthony Blake amb33 at cs.waikato.ac.nz
Fri Jul 6 05:40:50 PDT 2012


On Sat, Jul 7, 2012 at 12:25 AM, Anthony Blake <amb33 at cs.waikato.ac.nz> wrote:
> On Fri, Jul 6, 2012 at 6:39 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
>> On Jul 5, 2012, at 9:06 PM, Anthony Blake <amb33 at cs.waikato.ac.nz> wrote:
>>>        [...]
>>>       movaps  32(%rdi), %xmm3
>>>       movaps  48(%rdi), %xmm2
>>>       movaps  %xmm3, %xmm1     ### <-- xmm3 mov'ed into xmm1
>>>       movaps  %xmm3, %xmm4     ### <-- xmm3 mov'ed into xmm4
>>>       addps   %xmm0, %xmm1
>>>       movaps  %xmm1, -16(%rbp)        ## 16-byte Spill
>>>       movaps  144(%rdi), %xmm3   ### <-- new data mov'ed into xmm3
>>>        [...]
>>>
>>> xmm3 loaded, duplicated into 2 registers, and then discarded as other
>>> data is loaded into it. Can anyone shed some light on why this might
>>> be happening?
>>
>> I'm not actually seeing this behavior on trunk.
>>
>
> I've just tried trunk, and although behavior like above isn't
> immediately obvious, trunk generates more instructions and spills more
> registers compared to 3.1.
>

Actually, here is an occurrence of that behavior when compiling the
code with trunk:

        [...]
        movaps	%xmm1, %xmm0      ###  xmm1 mov'ed to xmm0
	movaps	%xmm1, %xmm14    ###  xmm1 mov'ed to xmm14
	addps	%xmm7, %xmm0
	movaps	%xmm7, %xmm13
	movaps	%xmm0, %xmm1      ###  and now other data is mov'ed into xmm1,
making one of the above movaps superfluous
        [...]

amb



More information about the llvm-dev mailing list