]> granicus.if.org Git - llvm/commitdiff
AMDGPU/SI: Fix Depth and Height computation for SI scheduler
authorMarek Olsak <marek.olsak@amd.com>
Tue, 25 Jul 2017 20:37:03 +0000 (20:37 +0000)
committerMarek Olsak <marek.olsak@amd.com>
Tue, 25 Jul 2017 20:37:03 +0000 (20:37 +0000)
Patch by: Axel Davy

Differential Revision: https://reviews.llvm.org/D34967

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309028 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AMDGPU/SIMachineScheduler.cpp

index de3ff627d9764598fec61091242c024f9de8be23..252915f785c58acb270849f091f6eedc814fd949 100644 (file)
@@ -1422,8 +1422,8 @@ void SIScheduleBlockCreator::fillStats() {
     else {
       unsigned Depth = 0;
       for (SIScheduleBlock *Pred : Block->getPreds()) {
-        if (Depth < Pred->Depth + 1)
-          Depth = Pred->Depth + 1;
+        if (Depth < Pred->Depth + Pred->getCost())
+          Depth = Pred->Depth + Pred->getCost();
       }
       Block->Depth = Depth;
     }
@@ -1437,7 +1437,7 @@ void SIScheduleBlockCreator::fillStats() {
     else {
       unsigned Height = 0;
       for (const auto &Succ : Block->getSuccs())
-        Height = std::min(Height, Succ.first->Height + 1);
+        Height = std::max(Height, Succ.first->Height + Succ.first->getCost());
       Block->Height = Height;
     }
   }