[llvm-commits] [llvm] r127351 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/X86/2011-03-09-Physreg-Coalescing.ll test/CodeGen/X86/fold-pcmpeqd-2.ll

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Mar 16 10:19:07 PDT 2011


On Mar 16, 2011, at 6:47 AM, NAKAMURA Takumi wrote:
>> Author: stoklund
>> Date: Wed Mar  9 13:27:06 2011
>> New Revision: 127351
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=127351&view=rev
>> Log:
>> Make physreg coalescing independent on the number of uses of the virtual register.
> 
> With r127351, X86/h-registers-1.ll is emitted differently on
> -mtriple=x86_64-win32.
> Is it expected or possible?

Yes, it is possible because the win32 calling convention uses different registers for the incoming arguments.

Physreg coalescing would extend the range of incoming physregs into the body of the function. That is actually a really bad idea in this function where the ABCD register classes are in use.

> llc -mtriple=x86_64-win32 < ~/llvm/test/CodeGen/X86/h-registers-1.ll \
> | grep 'movzbl.%[abcd]h' \
> | wc -l
> 
> ; w/o r127351
>        movzbl  %ah, %esi
>        movzbl  %ah, %eax
>        movzbl  %ah, %edi
>        movzbl  %bh, %ebx
>        movzbl  %dh, %edx
>        movzbl  %ah, %ebp
>        movzbl  %ch, %eax
>        movzbl  %ch, %ecx
> 
> ; with r127351;
>        movzbl  %ah, %eax
>        movzbl  %ah, %eax
>        movzbl  %ah, %ecx
>        movzbl  %bh, %eax
>        movzbl  %dh, %edx
>        movzbl  %bh, %esi
>        movzbl  15(%rsp), %edi          # 1-byte Folded Reload
>        movzbl  %bh, %ebx

In this case, the change caused a different register to be spilled, and the reload was folded into one of the movzbl instructions.

We can add an -mtriple argument to the test to make sure the calling convention doesn't change. The test isn't trying to test register allocation or spilling anyway.

/jakob




More information about the llvm-commits mailing list