[llvm-commits] [PATCH] Preserve sub-registers in PHIElimination

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Aug 18 09:11:26 PDT 2010

On Aug 17, 2010, at 10:32 PM, Krister Wombell wrote:

> PHI elimination doesn't preserve sub-registers of source operands when creating copy instructions. As an example take the following PHI instruction:
>     %reg1045<def> = PHI %reg3456:v4sub2, <BB#7>, %reg1050, <BB#9>; GPR:%reg1045,1050 QPR:%reg3456
> QPR represents 128 bit registers with 4 x 32 bit sub-registers and GPR represents single 32 bit registers. The PHI is correct: it's selecting either a 32 bit register from reg1050 or selecting a 32 bit sub-register of reg3456.
> After PHI elimination BB7 contains:
>     %reg3566<def> = COPY %reg3456; GPR:%reg3566 QPR:%reg3456
> Now there's a copy of a 128 bit register to a 32 bit register but without any sub-register to determine what is going on.
> The patch preserves the sub-registers when creating copy instructions.

Thanks, applied in r111366 with an additional assertion for subregs in the PHI def operand.

Do you have any test cases? I am a little confused how this is even possible. Random subreg operands are not introduced until coalescing.


More information about the llvm-commits mailing list