forked from OSchip/llvm-project
[ARM][RDA] Allow multiple killed users
In RDA, check against the already decided dead instructions when looking at users. This allows an instruction to be removed if it has multiple users, but they're all dead. This means that IT instructions can be considered killed once all the itstate using instructions are dead. Differential Revision: https://reviews.llvm.org/D75245
This commit is contained in:
parent
f9896435c9
commit
dfe8f5da4c
|
@ -547,7 +547,7 @@ ReachingDefAnalysis::isSafeToRemove(MachineInstr *MI, InstSet &Visited,
|
||||||
void ReachingDefAnalysis::collectLocalKilledOperands(MachineInstr *MI,
|
void ReachingDefAnalysis::collectLocalKilledOperands(MachineInstr *MI,
|
||||||
InstSet &Dead) const {
|
InstSet &Dead) const {
|
||||||
Dead.insert(MI);
|
Dead.insert(MI);
|
||||||
auto IsDead = [this](MachineInstr *Def, int PhysReg) {
|
auto IsDead = [this, &Dead](MachineInstr *Def, int PhysReg) {
|
||||||
unsigned LiveDefs = 0;
|
unsigned LiveDefs = 0;
|
||||||
for (auto &MO : Def->operands()) {
|
for (auto &MO : Def->operands()) {
|
||||||
if (!isValidRegDef(MO))
|
if (!isValidRegDef(MO))
|
||||||
|
@ -561,7 +561,10 @@ void ReachingDefAnalysis::collectLocalKilledOperands(MachineInstr *MI,
|
||||||
|
|
||||||
SmallPtrSet<MachineInstr*, 4> Uses;
|
SmallPtrSet<MachineInstr*, 4> Uses;
|
||||||
getGlobalUses(Def, PhysReg, Uses);
|
getGlobalUses(Def, PhysReg, Uses);
|
||||||
return Uses.size() == 1;
|
for (auto *Use : Uses)
|
||||||
|
if (!Dead.count(Use))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
for (auto &MO : MI->operands()) {
|
for (auto &MO : MI->operands()) {
|
||||||
|
|
|
@ -943,11 +943,8 @@ void ARMLowOverheadLoops::IterationCountDCE(LowOverheadLoop &LoLoop) {
|
||||||
if (ModifiedITs.empty()) {
|
if (ModifiedITs.empty()) {
|
||||||
LLVM_DEBUG(dbgs() << "ARM Loops: Will remove iteration count:\n";
|
LLVM_DEBUG(dbgs() << "ARM Loops: Will remove iteration count:\n";
|
||||||
for (auto *MI : Killed)
|
for (auto *MI : Killed)
|
||||||
dbgs() << " - " << *MI;
|
|
||||||
for (auto *MI : DeadITs)
|
|
||||||
dbgs() << " - " << *MI);
|
dbgs() << " - " << *MI);
|
||||||
LoLoop.ToRemove.insert(Killed.begin(), Killed.end());
|
LoLoop.ToRemove.insert(Killed.begin(), Killed.end());
|
||||||
LoLoop.ToRemove.insert(DeadITs.begin(), DeadITs.end());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect and remove the users of iteration count.
|
// Collect and remove the users of iteration count.
|
||||||
|
|
Loading…
Reference in New Issue