From: Marek Olsak Date: Tue, 25 Jul 2017 20:37:03 +0000 (+0000) Subject: AMDGPU/SI: Fix Depth and Height computation for SI scheduler X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6044a148c62452d24db6f2f5d1aed63d52663e39;p=llvm AMDGPU/SI: Fix Depth and Height computation for SI scheduler 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 --- diff --git a/lib/Target/AMDGPU/SIMachineScheduler.cpp b/lib/Target/AMDGPU/SIMachineScheduler.cpp index de3ff627d97..252915f785c 100644 --- a/lib/Target/AMDGPU/SIMachineScheduler.cpp +++ b/lib/Target/AMDGPU/SIMachineScheduler.cpp @@ -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; } }