From 6096f542d19d7e85e837bcd1c6facd0ef49a0398 Mon Sep 17 00:00:00 2001 From: Marek Olsak Date: Tue, 25 Jul 2017 20:37:03 +0000 Subject: [PATCH] AMDGPU/SI: Fix Depth and Height computation for SI scheduler Patch by: Axel Davy Differential Revision: https://reviews.llvm.org/D34967 llvm-svn: 309028 --- llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp b/llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp index de3ff62..252915f 100644 --- a/llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp +++ b/llvm/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; } } -- 2.7.4