LiveRangeQuery simplifies shrinkToUses().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157145 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen 2012-05-20 02:54:52 +00:00
parent 93e29ce066
commit 97769fcdd1

View File

@ -654,9 +654,8 @@ bool LiveIntervals::shrinkToUses(LiveInterval *li,
if (UseMI->isDebugValue() || !UseMI->readsVirtualRegister(li->reg)) if (UseMI->isDebugValue() || !UseMI->readsVirtualRegister(li->reg))
continue; continue;
SlotIndex Idx = getInstructionIndex(UseMI).getRegSlot(); SlotIndex Idx = getInstructionIndex(UseMI).getRegSlot();
// Note: This intentionally picks up the wrong VNI in case of an EC redef. LiveRangeQuery LRQ(*li, Idx);
// See below. VNInfo *VNI = LRQ.valueIn();
VNInfo *VNI = li->getVNInfoBefore(Idx);
if (!VNI) { if (!VNI) {
// This shouldn't happen: readsVirtualRegister returns true, but there is // This shouldn't happen: readsVirtualRegister returns true, but there is
// no live value. It is likely caused by a target getting <undef> flags // no live value. It is likely caused by a target getting <undef> flags
@ -667,13 +666,10 @@ bool LiveIntervals::shrinkToUses(LiveInterval *li,
continue; continue;
} }
// Special case: An early-clobber tied operand reads and writes the // Special case: An early-clobber tied operand reads and writes the
// register one slot early. The getVNInfoBefore call above would have // register one slot early.
// picked up the value defined by UseMI. Adjust the kill slot and value. if (VNInfo *DefVNI = LRQ.valueDefined())
if (SlotIndex::isSameInstr(VNI->def, Idx)) { Idx = DefVNI->def;
Idx = VNI->def;
VNI = li->getVNInfoBefore(Idx);
assert(VNI && "Early-clobber tied value not available");
}
WorkList.push_back(std::make_pair(Idx, VNI)); WorkList.push_back(std::make_pair(Idx, VNI));
} }