[PATCH] D75245: [ARM][RDA] Allow multiple killed users

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 07:14:33 PST 2020


samparker updated this revision to Diff 247639.
samparker added a comment.

Rebased!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75245/new/

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
@@ -547,7 +547,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 (!isValidRegDef(MO))
@@ -561,7 +561,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.247639.patch
Type: text/x-patch
Size: 1579 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200302/66ea41a5/attachment.bin>


More information about the llvm-commits mailing list