Delete merged physreg copies in joinReservedPhysReg().
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 3 Aug 2012 22:12:51 +0000 (22:12 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 3 Aug 2012 22:12:51 +0000 (22:12 +0000)
Previously, the identity copy would survive through register allocation
before it was removed by the rewriter.

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

lib/CodeGen/RegisterCoalescer.cpp

index 1fcc24d7e0adada9fa014edbfecbb12ac58195f0..990633440e0fb42fee99a48ae734dc63a5bc1ae9 100644 (file)
@@ -1091,6 +1091,11 @@ bool RegisterCoalescer::joinReservedPhysReg(CoalescerPair &CP) {
   // register live range doesn't need to be accurate as long as all the
   // defs are there.
 
+  // Delete the identity copy.
+  MachineInstr *CopyMI = MRI->getVRegDef(RHS.reg);
+  LIS->RemoveMachineInstrFromMaps(CopyMI);
+  CopyMI->eraseFromParent();
+
   // We don't track kills for reserved registers.
   MRI->clearKillFlags(CP.getSrcReg());