AMDGPU/SI: Fix Depth and Height computation for SI scheduler

Patch by: Axel Davy

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

llvm-svn: 309028
This commit is contained in:
Marek Olsak 2017-07-25 20:37:03 +00:00
parent e6f74384b1
commit 6096f542d1
1 changed files with 3 additions and 3 deletions

View 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;
}
}