[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


================
@@ -788,14 +788,15 @@ bool MachineSinking::runOnMachineFunction(MachineFunction &MF) {
   if (SinkInstsIntoCycle) {
     SmallVector<MachineCycle *, 8> Cycles(CI->toplevel_cycles());
     SchedModel.init(STI);
-    enum CycleSinkStage { COPY, LOW_LATENCY, AGGRESSIVE, END };
-
-    CycleSinkStage Stage = CycleSinkStage::COPY;
     bool HasHighPressure;
-    do {
+    DenseMap<std::pair<MachineInstr *, MachineBasicBlock *>, MachineInstr *>
+        SunkInstrs;
+
+    enum CycleSinkStage { COPY, LOW_LATENCY, AGGRESSIVE, END };
+    for (unsigned Stage = CycleSinkStage::COPY; Stage != CycleSinkStage::END;
+         ++Stage) {
----------------
arsenm wrote:

```suggestion
    for (unsigned Stage = CycleSinkStage::COPY; Stage != CycleSinkStage::END;
         ++Stage, SunkInstrs.clear()) {
```

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


More information about the llvm-commits mailing list