aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-11-14 18:45:38 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-11-14 18:45:38 +0000
commitf054e198197122011fc80b673f35333bc3e58c98 (patch)
tree90d575cf4438a85541b2a668272cd3a4f10c30b8 /lib/CodeGen/LiveIntervalAnalysis.cpp
parent96b685b4aadef3c273fead1ea8788e1452d7bbea (diff)
downloadexternal_llvm-f054e198197122011fc80b673f35333bc3e58c98.zip
external_llvm-f054e198197122011fc80b673f35333bc3e58c98.tar.gz
external_llvm-f054e198197122011fc80b673f35333bc3e58c98.tar.bz2
Fix early-clobber handling in shrinkToUses.
I broke this in r144515, it affected most ARM testers. <rdar://problem/10441389> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144547 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index 2ec2cbc..edcfebe 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -659,7 +659,9 @@ bool LiveIntervals::shrinkToUses(LiveInterval *li,
if (UseMI->isDebugValue() || !UseMI->readsVirtualRegister(li->reg))
continue;
SlotIndex Idx = getInstructionIndex(UseMI).getRegSlot();
- VNInfo *VNI = li->getVNInfoAt(Idx.getBaseIndex());
+ // Note: This intentionally picks up the wrong VNI in case of an EC redef.
+ // See below.
+ VNInfo *VNI = li->getVNInfoBefore(Idx);
if (!VNI) {
// This shouldn't happen: readsVirtualRegister returns true, but there is
// no live value. It is likely caused by a target getting <undef> flags
@@ -669,10 +671,11 @@ bool LiveIntervals::shrinkToUses(LiveInterval *li,
<< *li << '\n');
continue;
}
- if (VNI->def == Idx.getRegSlot(true)) {
- // Special case: An early-clobber tied operand reads and writes the
- // register one slot early.
- Idx = Idx.getRegSlot(true);
+ // Special case: An early-clobber tied operand reads and writes the
+ // register one slot early. The getVNInfoBefore call above would have
+ // picked up the value defined by UseMI. Adjust the kill slot and value.
+ if (SlotIndex::isSameInstr(VNI->def, Idx)) {
+ Idx = VNI->def;
VNI = li->getVNInfoBefore(Idx);
assert(VNI && "Early-clobber tied value not available");
}
@@ -687,13 +690,6 @@ bool LiveIntervals::shrinkToUses(LiveInterval *li,
if (VNI->isUnused())
continue;
NewLI.addRange(LiveRange(VNI->def, VNI->def.getDeadSlot(), VNI));
-
- // A use tied to an early-clobber def ends at the load slot and isn't caught
- // above. Catch it here instead. This probably only ever happens for inline
- // assembly.
- if (VNI->def.isEarlyClobber())
- if (VNInfo *UVNI = li->getVNInfoBefore(VNI->def))
- WorkList.push_back(std::make_pair(VNI->def, UVNI));
}
// Keep track of the PHIs that are in use.