Skip to content

Commit dfe8f5d

Browse files
committed
[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
1 parent f989643 commit dfe8f5d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

llvm/lib/CodeGen/ReachingDefAnalysis.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ ReachingDefAnalysis::isSafeToRemove(MachineInstr *MI, InstSet &Visited,
547547
void ReachingDefAnalysis::collectLocalKilledOperands(MachineInstr *MI,
548548
InstSet &Dead) const {
549549
Dead.insert(MI);
550-
auto IsDead = [this](MachineInstr *Def, int PhysReg) {
550+
auto IsDead = [this, &Dead](MachineInstr *Def, int PhysReg) {
551551
unsigned LiveDefs = 0;
552552
for (auto &MO : Def->operands()) {
553553
if (!isValidRegDef(MO))
@@ -561,7 +561,10 @@ void ReachingDefAnalysis::collectLocalKilledOperands(MachineInstr *MI,
561561

562562
SmallPtrSet<MachineInstr*, 4> Uses;
563563
getGlobalUses(Def, PhysReg, Uses);
564-
return Uses.size() == 1;
564+
for (auto *Use : Uses)
565+
if (!Dead.count(Use))
566+
return false;
567+
return true;
565568
};
566569

567570
for (auto &MO : MI->operands()) {

llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -943,11 +943,8 @@ void ARMLowOverheadLoops::IterationCountDCE(LowOverheadLoop &LoLoop) {
943943
if (ModifiedITs.empty()) {
944944
LLVM_DEBUG(dbgs() << "ARM Loops: Will remove iteration count:\n";
945945
for (auto *MI : Killed)
946-
dbgs() << " - " << *MI;
947-
for (auto *MI : DeadITs)
948946
dbgs() << " - " << *MI);
949947
LoLoop.ToRemove.insert(Killed.begin(), Killed.end());
950-
LoLoop.ToRemove.insert(DeadITs.begin(), DeadITs.end());
951948
}
952949

953950
// Collect and remove the users of iteration count.

0 commit comments

Comments
 (0)