summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineCSE.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-05-13 19:24:00 +0000
committerDan Gohman <gohman@apple.com>2010-05-13 19:24:00 +0000
commit7767d2747b06725697036bb4cd9a2ea95b92684c (patch)
treee95b68c00150c6371f9abaf443757b8f3d890eef /llvm/lib/CodeGen/MachineCSE.cpp
parent5b510c14742650615c9a3129a97fb4a634c1f77a (diff)
downloadbcm5719-llvm-7767d2747b06725697036bb4cd9a2ea95b92684c.tar.gz
bcm5719-llvm-7767d2747b06725697036bb4cd9a2ea95b92684c.zip
Add a utility function for conservatively clearing kill flags, and make
use of it in MachineCSE. llvm-svn: 103726
Diffstat (limited to 'llvm/lib/CodeGen/MachineCSE.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineCSE.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineCSE.cpp b/llvm/lib/CodeGen/MachineCSE.cpp
index 84c3d717f7f..cfe50408e6e 100644
--- a/llvm/lib/CodeGen/MachineCSE.cpp
+++ b/llvm/lib/CodeGen/MachineCSE.cpp
@@ -112,6 +112,7 @@ bool MachineCSE::PerformTrivialCoalescing(MachineInstr *MI,
DEBUG(dbgs() << "Coalescing: " << *DefMI);
DEBUG(dbgs() << "*** to: " << *MI);
MO.setReg(SrcReg);
+ MRI->clearKillFlags(SrcReg);
if (NewRC != SRC)
MRI->setRegClass(SrcReg, NewRC);
DefMI->eraseFromParent();
@@ -365,8 +366,10 @@ bool MachineCSE::ProcessBlock(MachineBasicBlock *MBB) {
// Actually perform the elimination.
if (DoCSE) {
- for (unsigned i = 0, e = CSEPairs.size(); i != e; ++i)
+ for (unsigned i = 0, e = CSEPairs.size(); i != e; ++i) {
MRI->replaceRegWith(CSEPairs[i].first, CSEPairs[i].second);
+ MRI->clearKillFlags(CSEPairs[i].second);
+ }
MI->eraseFromParent();
++NumCSEs;
} else {
OpenPOWER on IntegriCloud