Codegen pass definition cleanup. No functionality.
[oota-llvm.git] / lib / CodeGen / MachineCopyPropagation.cpp
index c82f81b6b5840e99b4378d5bda8cf0268a0f6c8e..ed3f3498f5fa7295bcc22a793037b2de3c7e2c56 100644 (file)
@@ -33,7 +33,7 @@ namespace {
   class MachineCopyPropagation : public MachineFunctionPass {
     const TargetRegisterInfo *TRI;
     BitVector ReservedRegs;
-    
+
   public:
     static char ID; // Pass identification, replacement for typeid
     MachineCopyPropagation() : MachineFunctionPass(ID) {
@@ -50,14 +50,11 @@ namespace {
   };
 }
 char MachineCopyPropagation::ID = 0;
+char &llvm::MachineCopyPropagationID = MachineCopyPropagation::ID;
 
 INITIALIZE_PASS(MachineCopyPropagation, "machine-cp",
                 "Machine Copy Propagation Pass", false, false)
 
-FunctionPass *llvm::createMachineCopyPropagationPass() {
-  return new MachineCopyPropagation();
-}
-
 void
 MachineCopyPropagation::SourceNoLongerAvailable(unsigned Reg,
                               DenseMap<unsigned, unsigned> &SrcMap,
@@ -142,7 +139,12 @@ bool MachineCopyPropagation::CopyPropagateBlock(MachineBasicBlock &MBB) {
           // %RSP<def> = COPY %RAX
           // CALL
           // %RAX<def> = COPY %RSP
-          CopyMI->getOperand(1).setIsKill(false);
+
+          // Clear any kills of Def between CopyMI and MI. This extends the
+          // live range.
+          for (MachineBasicBlock::iterator I = CopyMI, E = MI; I != E; ++I)
+            I->clearRegisterKills(Def, TRI);
+
           MI->eraseFromParent();
           Changed = true;
           ++NumDeletes;