summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/ProcessImplicitDefs.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-11-26 00:32:36 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-11-26 00:32:36 +0000
commit595a16300c3e748424a97cef6c70c13a201ad9de (patch)
treefba7c9c6be53108cb8a73908c673fdd25a2e1ff9 /llvm/lib/CodeGen/ProcessImplicitDefs.cpp
parent2d4ff12da9bf09cfb4790ec41183d9e5b94d5c88 (diff)
downloadbcm5719-llvm-595a16300c3e748424a97cef6c70c13a201ad9de.tar.gz
bcm5719-llvm-595a16300c3e748424a97cef6c70c13a201ad9de.zip
When all defs of a vr are implicit_def, delete all of the defs.
llvm-svn: 89905
Diffstat (limited to 'llvm/lib/CodeGen/ProcessImplicitDefs.cpp')
-rw-r--r--llvm/lib/CodeGen/ProcessImplicitDefs.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/ProcessImplicitDefs.cpp b/llvm/lib/CodeGen/ProcessImplicitDefs.cpp
index a484beccb9e..c9a33d88515 100644
--- a/llvm/lib/CodeGen/ProcessImplicitDefs.cpp
+++ b/llvm/lib/CodeGen/ProcessImplicitDefs.cpp
@@ -183,19 +183,23 @@ bool ProcessImplicitDefs::runOnMachineFunction(MachineFunction &fn) {
// is not an implicit_def, do not insert implicit_def's before the
// uses.
bool Skip = false;
+ SmallVector<MachineInstr*, 4> DeadImpDefs;
for (MachineRegisterInfo::def_iterator DI = mri_->def_begin(Reg),
DE = mri_->def_end(); DI != DE; ++DI) {
- if (DI->getOpcode() != TargetInstrInfo::IMPLICIT_DEF) {
+ MachineInstr *DeadImpDef = &*DI;
+ if (DeadImpDef->getOpcode() != TargetInstrInfo::IMPLICIT_DEF) {
Skip = true;
break;
}
+ DeadImpDefs.push_back(DeadImpDef);
}
if (Skip)
continue;
// The only implicit_def which we want to keep are those that are live
// out of its block.
- MI->eraseFromParent();
+ for (unsigned j = 0, ee = DeadImpDefs.size(); j != ee; ++j)
+ DeadImpDefs[j]->eraseFromParent();
Changed = true;
// Process each use instruction once.
OpenPOWER on IntegriCloud