llvm-6502/test/CodeGen/Blackfin
Jakob Stoklund Olesen ded2e3b0d0 LowerSubregsInstructionPass::LowerExtract should not extend the live range of registers.
When LowerExtract eliminates an EXTRACT_SUBREG with a kill flag, it moves the
kill flag to the place where the sub-register is killed. This can accidentally
overlap with the use of a sibling sub-register, and we have trouble.

In the test case we have this code:

Live Ins: %R0 %R1 %R2
	%R2L<def> = EXTRACT_SUBREG %R2<kill>, 1
	%R2H<def> = LOAD16fi <fi#-1>, 0, Mem:LD(2,4) [FixedStack-1 + 0]
	%R1L<def> = EXTRACT_SUBREG %R1<kill>, 1
	%R0L<def> = EXTRACT_SUBREG %R0<kill>, 1
	%R0H<def> = ADD16 %R2H<kill>, %R2L<kill>, %AZ<imp-def>, %AN<imp-def>, %AC0<imp-def>, %V<imp-def>, %VS<imp-def>

subreg: CONVERTING: %R2L<def> = EXTRACT_SUBREG %R2<kill>, 1
subreg: eliminated!
subreg: killed here: %R0H<def> = ADD16 %R2H, %R2L, %R2<imp-use,kill>, %AZ<imp-def>, %AN<imp-def>, %AC0<imp-def>, %V<imp-def>, %VS<imp-def>

The kill flag on %R2 is moved to the last instruction, and the live range overlaps with the definition of %R2H:

*** Bad machine code: Redefining a live physical register ***
- function:    f
- basic block:  0x18358c0 (#0)
- instruction: %R2H<def> = LOAD16fi <fi#-1>, 0, Mem:LD(2,4) [FixedStack-1 + 0]
Register R2H was defined but already live.

The fix is to replace EXTRACT_SUBREG with IMPLICIT_DEF instead of eliminating
it completely:

subreg: CONVERTING: %R2L<def> = EXTRACT_SUBREG %R2<kill>, 1
subreg: replace by: %R2L<def> = IMPLICIT_DEF %R2<kill>

Note that these IMPLICIT_DEF instructions survive to the asm output. It is
necessary to fix the stack-color-with-reg test case because of that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78093 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-04 20:01:11 +00:00
..
2009-08-04-LowerExtract-Live.ll LowerSubregsInstructionPass::LowerExtract should not extend the live range of registers. 2009-08-04 20:01:11 +00:00
add-overflow.ll
add.ll
addsub-i128.ll Fix issue in regscavenger when scavenging a callee-saved register that has not been spilled. 2009-08-02 20:29:41 +00:00
basic-i1.ll
basic-i8.ll
basic-i16.ll
basic-i32.ll
basic-i64.ll
basictest.ll
burg.ll
cmp64.ll
cmp-small-imm.ll Never add a kill flag to a constrained physical register in a two-addr instruction. 2009-08-02 19:13:03 +00:00
ct32.ll
ct64.ll
ctlz16.ll
ctlz64.ll
ctpop16.ll
cttz16.ll
cycles.ll
dg.exp
double-cast.ll
frameindex.ll
i1mem.ll
i1ops.ll
i8mem.ll
i17mem.ll
i56param.ll
i216mem.ll
i248mem.ll
i256mem.ll
i256param.ll
inline-asm.ll
int-setcc.ll
invalid-apint.ll
jumptable.ll
large-switch.ll
load-i16.ll
logic-i16.ll
many-args.ll
mulhu.ll
printf2.ll
printf.ll
promote-logic.ll
promote-setcc.ll Never add a kill flag to a constrained physical register in a two-addr instruction. 2009-08-02 19:13:03 +00:00
sdiv.ll
simple-select.ll
switch2.ll
switch.ll
sync-intr.ll Add some basic blackfin intrinsics. 2009-08-02 18:28:11 +00:00