Fix for PR4121. If TwoAddressInstructionPass removes a dead def, and the regB
operand was killed, the kill needs to be removed from regB's VarInfo.
llvm-svn: 71635
diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
index e37639e..2ec0c71 100644
--- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -858,6 +858,12 @@
}
}
}
+
+ // We're really going to nuke the old inst. If regB was marked
+ // as a kill we need to update its Kills list.
+ if (mi->getOperand(si).isKill())
+ LV->removeVirtualRegisterKilled(regB, mi);
+
mbbi->erase(mi); // Nuke the old inst.
mi = nmi;
++NumDeletes;