If we reload a virtual register that's already been assigned, we want to mark
[oota-llvm.git] / lib / CodeGen / RegAllocLocal.cpp
index 99fc6c9028ab7ba4a6d9b3e55c8af02570ba3e2e..9e274543cf5cd7192e2d5c80af416fd0372814ac 100644 (file)
@@ -480,8 +480,9 @@ MachineInstr *RALocal::reloadVirtReg(MachineBasicBlock &MBB, MachineInstr *MI,
   // If the virtual register is already available, just update the instruction
   // and return.
   if (unsigned PR = getVirt2PhysRegMapSlot(VirtReg)) {
-    MarkPhysRegRecentlyUsed(PR);          // Already have this value available!
+    MarkPhysRegRecentlyUsed(PR);       // Already have this value available!
     MI->getOperand(OpNum).setReg(PR);  // Assign the input register
+    getVirtRegLastUse(VirtReg) = std::make_pair(MI, OpNum);
     return MI;
   }