[llvm] r309028 - AMDGPU/SI: Fix Depth and Height computation for SI scheduler

Marek Olsak via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 25 13:37:03 PDT 2017


Author: mareko
Date: Tue Jul 25 13:37:03 2017
New Revision: 309028

URL: http://llvm.org/viewvc/llvm-project?rev=309028&view=rev
Log:
AMDGPU/SI: Fix Depth and Height computation for SI scheduler

Patch by: Axel Davy

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

Modified:
    llvm/trunk/lib/Target/AMDGPU/SIMachineScheduler.cpp

Modified: llvm/trunk/lib/Target/AMDGPU/SIMachineScheduler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIMachineScheduler.cpp?rev=309028&r1=309027&r2=309028&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIMachineScheduler.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIMachineScheduler.cpp Tue Jul 25 13:37:03 2017
@@ -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;
     }
   }




More information about the llvm-commits mailing list