[llvm] [MISched] Add statistics to quantify scheduling (PR #138090)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Thu May 1 09:21:25 PDT 2025


================
@@ -3979,6 +3990,17 @@ SUnit *GenericScheduler::pickNode(bool &IsTopNode) {
 
   LLVM_DEBUG(dbgs() << "Scheduling SU(" << SU->NodeNum << ") "
                     << *SU->getInstr());
+
+  if (IsTopNode) {
+    if (SU->NodeNum == TopIdx++)
+      ++NumInstrsInSourceOrderPreRA;
+  } else {
+    if (SU->NodeNum == BotIdx--)
----------------
mshockwave wrote:

could you assert that BotIdx will always be less than NumRegionInstrs to prevent underflow?

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


More information about the llvm-commits mailing list