A restore is promoted to copy (or deleted entirely), remove the kill from the last...
authorEvan Cheng <evan.cheng@apple.com>
Thu, 1 Mar 2007 02:27:30 +0000 (02:27 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 1 Mar 2007 02:27:30 +0000 (02:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34773 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/VirtRegMap.cpp

index ceb4acee69827290867ebd27c675ba935505834f..0f5c48aaa9b84bdff09445c403015055ffaed055 100644 (file)
@@ -855,14 +855,15 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM) {
               } else
                 DOUT << "Removing now-noop copy: " << MI;
 
-              // Extend the live range of the MI that last kill the register if
-              // the next MI reuse it.
+              // Either way, the live range of the last kill of InReg has been
+              // extended. Remove its kill.
               MachineOperand *MOK = SSMI->findRegisterUseOperand(InReg, true);
               if (MOK && NextMII != MBB.end()) {
+                MOK->unsetIsKill();
+                // If NextMII uses InReg (must be the copy?), mark it killed.
                 MachineOperand *MOU = NextMII->findRegisterUseOperand(InReg);
                 if (MOU) {
                   MOU->setIsKill();
-                  MOK->unsetIsKill();
                   Spills.UpdateLastUse(InReg, &(*NextMII));
                 }
               }