[llvm-commits] [llvm] r77989 - in /llvm/trunk: lib/CodeGen/LowerSubregs.cpp lib/CodeGen/MachineInstr.cpp test/CodeGen/ARM/2009-08-02-RegScavengerAssert-Neon.ll

Jakob Stoklund Olesen stoklund at chora.dk
Tue Aug 4 03:12:12 PDT 2009


Evan Cheng <evan.cheng at apple.com> writes:
> I agree in this case the undef marker must be removed. The only  
> argument who should remove it.

Actually, this is a bad example because LowerExtract's behaviour is
wrong for another reason. Consider this code:

	%R0L<def> = EXTRACT_SUBREG %R0<kill>, 1
    %R0H<def> = MOVE16i 12345
    %P0<def> = STORE16_inc %P0, %R0H<kill>
    %P0<def> = STORE16_inc %P0, %R0L<kill>

LowerExtract eliminates EXTRACT_SUBREG and moves the %R0<kill> flag to
the last instruction (where %R0L is killed):

    %R0H<def> = MOVE16i 12345
    %P0<def> = STORE16_inc %P0, %R0H<kill>
    %P0<def> = STORE16_inc %P0, %R0L<kill>, %R0<imp-kill>

This means that the live range of %R0 has been extended with two
instructions, and we get a double-def when defining the other
subregister %R0H.

I'll see if I can produce a test case.



There is still an issue with the <undef> semantics. Look at this:

    %R0<def> = INSERT_SUBREG %R0<undef>, %R1H<kill>, 1

LowerInsert replaces it with

    %R0L<def> = COPY16 %R1H<kill>, %R0<imp-kill>, %R0<imp-def>

Should there be an %R0<imp-kill> or not? If %R0 is live it is
required. If %R0 is dead it would be illegal. There are two choices:

1) We allow %R0<imp-kill, undef> with "soft semantics".

2) We require "undef implies dead" so we can remove the <imp-kill>.





More information about the llvm-commits mailing list