When deleting a machine instruction, make sure to remove it from the
authorChris Lattner <sabre@nondot.org>
Sun, 3 Sep 2006 00:06:08 +0000 (00:06 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 3 Sep 2006 00:06:08 +0000 (00:06 +0000)
livevariables information.  This fixes several regalloc=local failures on x86

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

lib/CodeGen/RegAllocLocal.cpp

index dd8a8815604637e1876003bcf78073c135be10b0..c435c34f49e0ef85368c75851a3f01c382c02aad 100644 (file)
@@ -659,8 +659,11 @@ void RA::AllocateBasicBlock(MachineBasicBlock &MBB) {
     
     // Finally, if this is a noop copy instruction, zap it.
     unsigned SrcReg, DstReg;
-    if (TII.isMoveInstr(*MI, SrcReg, DstReg) && SrcReg == DstReg)
+    if (TII.isMoveInstr(*MI, SrcReg, DstReg) && SrcReg == DstReg) {
+      LV->removeVirtualRegistersKilled(MI);
+      LV->removeVirtualRegistersDead(MI);
       MBB.erase(MI);
+    }
   }
 
   MachineBasicBlock::iterator MI = MBB.getFirstTerminator();