llvm-6502/test
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
..
Analysis Expand LDA testcases. 2009-08-02 23:28:14 +00:00
Archive
Assembler Add a new keyword 'inbounds' for use with getelementptr. See the 2009-07-27 21:53:46 +00:00
Bindings/Ocaml
Bitcode Use separate ValueList for metadata. 2009-08-04 06:00:18 +00:00
BugPoint
CodeGen LowerSubregsInstructionPass::LowerExtract should not extend the live range of registers. 2009-08-04 20:01:11 +00:00
DebugInfo upgrade 2009-06-23 22:11:37 +00:00
ExecutionEngine remove tests for removed intrinsics. 2009-07-12 21:30:06 +00:00
Feature Do not use abbrev while writing NamedMDNode name. 2009-07-30 23:06:35 +00:00
FrontendAda
FrontendC llvm-gcc checks the static asm variable is valid in ValidateRegisterVariable. Make this work for PPC. 2009-08-04 04:48:31 +00:00
FrontendC++ Add test for PR4678 2009-08-04 03:44:37 +00:00
FrontendFortran
FrontendObjC This test should be run with -m32. 2009-07-19 22:44:03 +00:00
FrontendObjC++
Integer
lib
Linker
LLVMC
MC/AsmParser llvm-mc: More quoted identifier support. 2009-08-01 00:48:30 +00:00
Other
Scripts
TableGen Add some tests of advanced TableGen list functionality. 2009-06-29 20:07:17 +00:00
Transforms Add -disable-output. Thanks Bill! 2009-08-03 22:24:22 +00:00
Verifier
Makefile Avoid a problem with ulimit on Solaris & friends, patch by Edward O'Callaghan! 2009-08-01 03:37:54 +00:00
Makefile.tests
TestRunner.sh