[llvm] [llvm][ScheduleDAG] SUnit::biasCriticalPath() does not find the criti... (PR #92368)

via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 01:48:54 PDT 2024


https://github.com/csstormq created https://github.com/llvm/llvm-project/pull/92368

…cal path consistently

Fix https://github.com/llvm/llvm-project/issues/38037

>From 80626a9589daa0ea6ba88fd24bcabe3f3eeea8cc Mon Sep 17 00:00:00 2001
From: Xu Xiaoqiang <swust_xiaoqiangxu at 163.com>
Date: Thu, 16 May 2024 16:43:18 +0800
Subject: [PATCH] [llvm][ScheduleDAG] SUnit::biasCriticalPath() does not find
 the critical path consistently

Fix https://github.com/llvm/llvm-project/issues/38037
---
 llvm/lib/CodeGen/ScheduleDAG.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/ScheduleDAG.cpp b/llvm/lib/CodeGen/ScheduleDAG.cpp
index de8e6f63794dc..8d9a5041fc2fe 100644
--- a/llvm/lib/CodeGen/ScheduleDAG.cpp
+++ b/llvm/lib/CodeGen/ScheduleDAG.cpp
@@ -331,8 +331,10 @@ void SUnit::biasCriticalPath() {
   unsigned MaxDepth = BestI->getSUnit()->getDepth();
   for (SUnit::pred_iterator I = std::next(BestI), E = Preds.end(); I != E;
        ++I) {
-    if (I->getKind() == SDep::Data && I->getSUnit()->getDepth() > MaxDepth)
+    if (I->getKind() == SDep::Data && I->getSUnit()->getDepth() > MaxDepth) {
+      MaxDepth = I->getSUnit()->getDepth();
       BestI = I;
+    }
   }
   if (BestI != Preds.begin())
     std::swap(*Preds.begin(), *BestI);



More information about the llvm-commits mailing list