[llvm] [MachineSink] Add capability for aggressive loop sinking (PR #117247)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 8 07:57:35 PST 2024


================
@@ -1748,12 +1752,12 @@ bool MachineSinking::aggressivelySinkIntoCycle(
       }
       SinkBlock->insert(SinkBlock->SkipPHIsAndLabels(SinkBlock->begin()),
                         NewMI);
-      SunkInstrs[MapEntry] = NewMI;
+      SunkInstrs.insert({MapEntry, NewMI});
     }
 
     // Conservatively clear any kill flags on uses of sunk instruction
-    for (MachineOperand &MO : NewMI->operands()) {
-      if (MO.isReg() && MO.readsReg())
+    for (MachineOperand &MO : NewMI->all_uses()) {
+      if (MO.isReg())
         RegsToClearKillFlags.insert(MO.getReg());
----------------
arsenm wrote:

Might need to check or assert isUse, I can never remember the intricacies of all the operand iterators 

https://github.com/llvm/llvm-project/pull/117247


More information about the llvm-commits mailing list