Fix PR10387.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Mon, 18 Jul 2011 05:31:59 +0000 (05:31 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Mon, 18 Jul 2011 05:31:59 +0000 (05:31 +0000)
When trying to rematerialize a value before an instruction that has an
early-clobber redefine of the virtual register, make sure to look up the
correct value number.

Early-clobber defs are moved one slot back, so getBaseIndex is needed to
find the used value number.

Bugpoint was unable to reduce the test case for this, see PR10388.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135378 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/InlineSpiller.cpp

index 5547f735ba5eaf2ba64fd6c394bd4078a5bf4ec8..f0f69872b03a44c27c58bfa22544964ba5f13536 100644 (file)
@@ -637,7 +637,7 @@ void InlineSpiller::markValueUsed(LiveInterval *LI, VNInfo *VNI) {
 bool InlineSpiller::reMaterializeFor(LiveInterval &VirtReg,
                                      MachineBasicBlock::iterator MI) {
   SlotIndex UseIdx = LIS.getInstructionIndex(MI).getUseIndex();
-  VNInfo *ParentVNI = VirtReg.getVNInfoAt(UseIdx);
+  VNInfo *ParentVNI = VirtReg.getVNInfoAt(UseIdx.getBaseIndex());
 
   if (!ParentVNI) {
     DEBUG(dbgs() << "\tadding <undef> flags: ");