[llvm] dfe8f5d - [ARM][RDA] Allow multiple killed users
Sam Parker via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 3 07:12:56 PST 2020
Author: Sam Parker
Date: 2020-03-03T15:12:29Z
New Revision: dfe8f5da4c707c447b80ff5bf78313b35621d9c4
URL: https://github.com/llvm/llvm-project/commit/dfe8f5da4c707c447b80ff5bf78313b35621d9c4
DIFF: https://github.com/llvm/llvm-project/commit/dfe8f5da4c707c447b80ff5bf78313b35621d9c4.diff
LOG: [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
Added:
Modified:
llvm/lib/CodeGen/ReachingDefAnalysis.cpp
llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
index 84029a0ac150..5f0b4a92f3ee 100644
--- a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
+++ b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
@@ -547,7 +547,7 @@ ReachingDefAnalysis::isSafeToRemove(MachineInstr *MI, InstSet &Visited,
void ReachingDefAnalysis::collectLocalKilledOperands(MachineInstr *MI,
InstSet &Dead) const {
Dead.insert(MI);
- auto IsDead = [this](MachineInstr *Def, int PhysReg) {
+ auto IsDead = [this, &Dead](MachineInstr *Def, int PhysReg) {
unsigned LiveDefs = 0;
for (auto &MO : Def->operands()) {
if (!isValidRegDef(MO))
@@ -561,7 +561,10 @@ void ReachingDefAnalysis::collectLocalKilledOperands(MachineInstr *MI,
SmallPtrSet<MachineInstr*, 4> 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()) {
diff --git a/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp b/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
index 2a2179f7d19c..92eb2e2cffed 100644
--- a/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
+++ b/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
@@ -943,11 +943,8 @@ void ARMLowOverheadLoops::IterationCountDCE(LowOverheadLoop &LoLoop) {
if (ModifiedITs.empty()) {
LLVM_DEBUG(dbgs() << "ARM Loops: Will remove iteration count:\n";
for (auto *MI : Killed)
- dbgs() << " - " << *MI;
- for (auto *MI : DeadITs)
dbgs() << " - " << *MI);
LoLoop.ToRemove.insert(Killed.begin(), Killed.end());
- LoLoop.ToRemove.insert(DeadITs.begin(), DeadITs.end());
}
// Collect and remove the users of iteration count.
More information about the llvm-commits
mailing list