llvm-6502/lib
Hal Finkel d281f1443a Consider subregs when calling MI::registerDefIsDead for phys deps
The scheduling dependency graph is built bottom-up within each scheduling
region, and ScheduleDAGInstrs::addPhysRegDeps is called to add output/anti
dependencies, based on physical registers, to the SUs for instructions
based on those that come before them.

In the test case, we start before post-RA scheduling with a block that looks
like this:

...
	INLINEASM <...
andc $0,$0,$2
stdcx. $0,0,$3
bne- 1b
> [sideeffect] [mayload] [maystore] [attdialect], $0:[regdef-ec:G8RC], %X6<earlyclobber,def,dead>, $1:[mem], %X3<kill>, $2:[reguse:G8RC], %X5<kill>, $3:[reguse:G8RC], %X3, $4:[mem], %X3, $5:[clobber], %CC<earlyclobber,imp-def,dead>, <<badref>>
	...
	%X4<def,dead> = ANDIo8 %X4<kill>, 1, %CR0<imp-def,dead>, %CR0GT<imp-def>
	...
	%R29<def> = ISEL %R3<undef>, %R4<kill>, %CR0GT<kill>

where it is relevant that %CC is an alias to %CR0, and that %CR0GT is a
subregister of %CR0. However, for post-RA scheduling, no dependency was added
to prevent the INLINEASM from being scheduled in between the ANDIo8 and the
ISEL (which communicate via the %CR0GT register).

In ScheduleDAGInstrs::addPhysRegDeps, when called for the %CC operand, we'd
iterate over all of its aliases (which include %CC itself and also %CR0), and
look for previously-encountered defs of those registers. We'd find the ANDIo8,
but decide not to add a dependency between the INLINEASM and the ANDIo8 because
both the INLINEASM's def of %CC is dead, and also the ANDIo8 def of %CR0 is
dead. This ignores, however, that ANDIo8 has a non-dead def of %CR0GT, a
subregister of %CR0, and thus a dependency still must exist.

To fix this problem, when calling registerDefIsDead on the SU with the def, we
also check all subregisters for possible non-dead defs, and add the dependency
if any are found.

Fixes PR21742.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223440 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 01:57:22 +00:00
..
Analysis Revert "r223364 - Revert r223347 which has caused crashes on bootstrap bots." 2014-12-04 17:45:19 +00:00
AsmParser Prologue support 2014-12-03 02:08:38 +00:00
Bitcode Ask the module for its the identified types. 2014-12-03 07:18:23 +00:00
CodeGen Consider subregs when calling MI::registerDefIsDead for phys deps 2014-12-05 01:57:22 +00:00
DebugInfo Make DWARFAcceleratorTable::dump() const. 2014-11-20 16:21:11 +00:00
ExecutionEngine [MCJIT] Unique-ptrify the RTDyldMemoryManager member of MCJIT. NFC. 2014-12-03 00:51:19 +00:00
IR IR: Stop relying on GetStringMapEntryFromValue() 2014-12-05 01:41:34 +00:00
IRReader Remove unused variable. NFC. 2014-11-06 23:16:57 +00:00
LineEditor
Linker linkGlobalVariableProto never returns null. Simplify the caller. NFC. 2014-12-05 00:30:47 +00:00
LTO Remove StringMap::GetOrCreateValue in favor of StringMap::insert 2014-11-19 05:49:42 +00:00
MC clang-formatted ranged loops and assignment, NFC. 2014-12-04 08:30:39 +00:00
Object Add mach-o LC_RPATH support to llvm-objdump 2014-12-04 07:37:02 +00:00
Option Add an overload of getLastArgNoClaim taking two OptSpecifiers. 2014-09-12 19:42:53 +00:00
ProfileData llvm-cov: Sink some reporting logic into CoverageMapping 2014-11-14 01:50:32 +00:00
Support Silence warning: variable 'buffer' set but not used. 2014-12-04 21:36:38 +00:00
TableGen Revert r222957 "Replace std::map<K, V*> with std::map<K, V> to handle ownership and deletion of the values." 2014-11-30 01:20:17 +00:00
Target Rename the x86 isTargetMacho to isTargetMachO for uniformity. 2014-12-05 00:22:38 +00:00
Transforms [InstCombine] Minor optimization for bswap with binary ops 2014-12-04 09:44:01 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile