From 1a96c914315b0286d84c507d696484e2c95875a4 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149069 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/MachineCopyPropagation.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/MachineCopyPropagation.cpp') diff --git a/lib/CodeGen/MachineCopyPropagation.cpp b/lib/CodeGen/MachineCopyPropagation.cpp index c82f81b6b5..f96c869143 100644 --- a/lib/CodeGen/MachineCopyPropagation.cpp +++ b/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