From 8c139a51259aed287c5e2c16bd10d799a25d43dd Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Thu, 26 Jan 2012 17:52:15 +0000 Subject: Clear kill flags before propagating a copy. The live range of the source register may be extended when a redundant copy is eliminated. Make sure any kill flags between the two copies are cleared. This fixes PR11765. llvm-svn: 149069 --- llvm/lib/CodeGen/MachineCopyPropagation.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/MachineCopyPropagation.cpp') diff --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp index c82f81b6b58..f96c8691437 100644 --- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp +++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp @@ -142,7 +142,12 @@ bool MachineCopyPropagation::CopyPropagateBlock(MachineBasicBlock &MBB) { // %RSP = COPY %RAX // CALL // %RAX = 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; -- cgit v1.2.3