llvm-project/llvm/test
Jakob Stoklund Olesen 6304369c4e 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.

llvm-svn: 78093
2009-08-04 20:01:11 +00:00
..
Analysis Expand LDA testcases. 2009-08-02 23:28:14 +00:00
Archive sabre brings to my attention that the 'tr' suffix is also obsolete 2008-05-20 21:00:03 +00:00
Assembler Add a new keyword 'inbounds' for use with getelementptr. See the 2009-07-27 21:53:46 +00:00
Bindings/Ocaml Nounwind is not valid for function return values. 2009-05-06 13:51:18 +00:00
Bitcode Use separate ValueList for metadata. 2009-08-04 06:00:18 +00:00
BugPoint Fix regular expression. 2009-06-12 05:39:02 +00:00
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 Adjust this test for recent sroa improvements. 2009-03-12 11:56:12 +00:00
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 These tests are x86 specific. 2009-04-22 10:39:51 +00:00
FrontendObjC This test should be run with -m32. 2009-07-19 22:44:03 +00:00
FrontendObjC++ This is an objective-c test, not an objective-c++ one. 2008-10-06 18:42:48 +00:00
Integer Converted a1.ll to unittests. 2009-03-24 21:36:09 +00:00
LLVMC The 'forward_as' property did not use its second argument. 2009-05-06 01:41:19 +00:00
Linker Reimplement the old and horrible bison parser for .ll files with a nice 2009-01-02 07:01:27 +00:00
MC/AsmParser llvm-mc: More quoted identifier support. 2009-08-01 00:48:30 +00:00
Other Add new function attribute - noimplicitfloat 2009-06-05 21:57:13 +00:00
Scripts simplify shell syntax to work better on solaris, patch by 2008-06-25 16:03:42 +00:00
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 Dan noticed that the verifier wasn't thoroughly checking uses of 2009-05-29 19:39:36 +00:00
lib In an XFAIL line, treat "XFAIL: foo*bar" as a regular expression to be matched 2009-06-12 05:18:32 +00:00
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 Fix a bashism in TestRunner.sh. 2008-07-28 18:41:03 +00:00