[PATCH] D75245: [ARM][RDA] Allow multiple killed users
Sam Parker via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 27 05:26:52 PST 2020
samparker created this revision.
samparker added reviewers: SjoerdMeijer, dmgreen.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: LLVM.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D75245
Files:
llvm/lib/CodeGen/ReachingDefAnalysis.cpp
llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
Index: llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
===================================================================
--- llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
+++ llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
@@ -943,11 +943,8 @@
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.
Index: llvm/lib/CodeGen/ReachingDefAnalysis.cpp
===================================================================
--- llvm/lib/CodeGen/ReachingDefAnalysis.cpp
+++ llvm/lib/CodeGen/ReachingDefAnalysis.cpp
@@ -523,7 +523,7 @@
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 (!MO.isReg() || !MO.getReg() || MO.isUse())
@@ -537,7 +537,10 @@
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()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75245.246921.patch
Type: text/x-patch
Size: 1602 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200227/d8863a82/attachment.bin>
More information about the llvm-commits
mailing list