Fixes the bug exposed by Anton's test case in PR 5495:
authorLang Hames <lhames@gmail.com>
Mon, 16 Nov 2009 02:07:31 +0000 (02:07 +0000)
committerLang Hames <lhames@gmail.com>
Mon, 16 Nov 2009 02:07:31 +0000 (02:07 +0000)
Make sure when ProcessImplicitDefs removes a copy which kills its source reg that it
removes the copy from said reg's Kills list.

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

lib/CodeGen/ProcessImplicitDefs.cpp

index 48567a0fc7f6919d476691b93c956f2ab2df4a93..23b78c74386c0a605921a9b94113b7ad9690b486 100644 (file)
@@ -209,6 +209,10 @@ bool ProcessImplicitDefs::runOnMachineFunction(MachineFunction &fn) {
         unsigned SrcReg, DstReg, SrcSubReg, DstSubReg;
         if (tii_->isMoveInstr(*RMI, SrcReg, DstReg, SrcSubReg, DstSubReg) &&
             Reg == SrcReg) {
+          if (RMO.isKill()) {
+            LiveVariables::VarInfo& vi = lv_->getVarInfo(Reg);
+            vi.removeKill(RMI);
+          }
           RMI->setDesc(tii_->get(TargetInstrInfo::IMPLICIT_DEF));
           for (int j = RMI->getNumOperands() - 1, ee = 0; j > ee; --j)
             RMI->RemoveOperand(j);