[llvm] [llvm][CodeGen] Fixed a bug in stall cycle calculation for window scheduler (PR #99451)

Kai Yan via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 21 20:30:18 PDT 2024


================
@@ -485,15 +485,17 @@ int WindowScheduler::calculateMaxCycle(ScheduleDAGInstrs &DAG,
 // ========================================
 int WindowScheduler::calculateStallCycle(unsigned Offset, int MaxCycle) {
   int MaxStallCycle = 0;
+  int CurrentII = MaxCycle + 1;
   auto Range = getScheduleRange(Offset, SchedInstrNum);
   for (auto &MI : Range) {
     auto *SU = TripleDAG->getSUnit(&MI);
     int DefCycle = getOriCycle(&MI);
     for (auto &Succ : SU->Succs) {
       if (Succ.isWeak() || Succ.getSUnit() == &TripleDAG->ExitSU)
         continue;
-      // If the expected cycle does not exceed MaxCycle, no check is needed.
-      if (DefCycle + (int)Succ.getLatency() <= MaxCycle)
+      // If the expected cycle does not exceed loop initiation interval, no
----------------
kaiyan96 wrote:

Updated.

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


More information about the llvm-commits mailing list