mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-16 14:31:59 +00:00
When all defs of a vr are implicit_def, delete all of the defs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89905 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
15acadde5f
commit
40ea0e22b2
@ -183,19 +183,23 @@ bool ProcessImplicitDefs::runOnMachineFunction(MachineFunction &fn) {
|
|||||||
// is not an implicit_def, do not insert implicit_def's before the
|
// is not an implicit_def, do not insert implicit_def's before the
|
||||||
// uses.
|
// uses.
|
||||||
bool Skip = false;
|
bool Skip = false;
|
||||||
|
SmallVector<MachineInstr*, 4> DeadImpDefs;
|
||||||
for (MachineRegisterInfo::def_iterator DI = mri_->def_begin(Reg),
|
for (MachineRegisterInfo::def_iterator DI = mri_->def_begin(Reg),
|
||||||
DE = mri_->def_end(); DI != DE; ++DI) {
|
DE = mri_->def_end(); DI != DE; ++DI) {
|
||||||
if (DI->getOpcode() != TargetInstrInfo::IMPLICIT_DEF) {
|
MachineInstr *DeadImpDef = &*DI;
|
||||||
|
if (DeadImpDef->getOpcode() != TargetInstrInfo::IMPLICIT_DEF) {
|
||||||
Skip = true;
|
Skip = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
DeadImpDefs.push_back(DeadImpDef);
|
||||||
}
|
}
|
||||||
if (Skip)
|
if (Skip)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// The only implicit_def which we want to keep are those that are live
|
// The only implicit_def which we want to keep are those that are live
|
||||||
// out of its block.
|
// out of its block.
|
||||||
MI->eraseFromParent();
|
for (unsigned j = 0, ee = DeadImpDefs.size(); j != ee; ++j)
|
||||||
|
DeadImpDefs[j]->eraseFromParent();
|
||||||
Changed = true;
|
Changed = true;
|
||||||
|
|
||||||
// Process each use instruction once.
|
// Process each use instruction once.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user