[llvm] [llvm][CodeGen] Fixed max cycle calculation with zero-cost instructions for window scheduler (PR #99454)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 19 02:46:55 PDT 2024


================
@@ -437,12 +437,16 @@ int WindowScheduler::calculateMaxCycle(ScheduleDAGInstrs &DAG,
       int PredCycle = getOriCycle(PredMI);
       ExpectCycle = std::max(ExpectCycle, PredCycle + (int)Pred.getLatency());
     }
-    // ResourceManager can be used to detect resource conflicts between the
-    // current MI and the previously inserted MIs.
-    while (!RM.canReserveResources(*SU, CurCycle) || CurCycle < ExpectCycle) {
-      ++CurCycle;
-      if (CurCycle == (int)WindowIILimit)
-        return CurCycle;
+    // Zero cost instructions do not need to check resource.
+    if (!TII->isZeroCost(MI.getOpcode())) {
----------------
arsenm wrote:

> COPY do not occupy hardware resources 

This is a very target specific assumption but ok 

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


More information about the llvm-commits mailing list