aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineCopyPropagation.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-01-26 17:52:15 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-01-26 17:52:15 +0000
commit8c139a51259aed287c5e2c16bd10d799a25d43dd (patch)
tree5b4d4d2299efa5a47b3a1e23d666932cd5eee2ed /llvm/lib/CodeGen/MachineCopyPropagation.cpp
parentfabfcd8beabdaaf713b5b40b851f999c9cc0da75 (diff)
downloadllvm-8c139a51259aed287c5e2c16bd10d799a25d43dd.zip
llvm-8c139a51259aed287c5e2c16bd10d799a25d43dd.tar.gz
llvm-8c139a51259aed287c5e2c16bd10d799a25d43dd.tar.bz2
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
Diffstat (limited to 'llvm/lib/CodeGen/MachineCopyPropagation.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineCopyPropagation.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
index c82f81b..f96c869 100644
--- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp
+++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
@@ -142,7 +142,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;