[llvm-bugs] [Bug 38689] New: biasCriticalPath does not find the critical path consistently
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Aug 24 08:41:11 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38689
Bug ID: 38689
Summary: biasCriticalPath does not find the critical path
consistently
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: gongyuwang at micron.com
CC: llvm-bugs at lists.llvm.org
SUnit::biasCriticalPath() is a simple function that finds the deepest
Predecessor and swap it with the head of this->Preds vector.
Since the code is short, it is probably easier to explain with the code:
void SUnit::biasCriticalPath() {
if (NumPreds < 2)
return;
SUnit::pred_iterator BestI = Preds.begin();
unsigned MaxDepth = BestI->getSUnit()->getDepth();
for (SUnit::pred_iterator I = std::next(BestI), E = Preds.end(); I != E;
++I) {
if (I->getKind() == SDep::Data && I->getSUnit()->getDepth() > MaxDepth)
BestI = I; // Need to update MaxDepth
}
if (BestI != Preds.begin())
std::swap(*Preds.begin(), *BestI);
}
As the comment in the above code suggest, after BestI is updated, MaxDepth (=
BestI->getSUnit()->getDepth()) should also be updated. But the current code
does not do this, which would fail to find the correct Predecessor
consistently. For example, if this SUnit has three Predecessors (the first
Predecessor has depth 1; the second and third Predecessors are both Data
dependences with depths of 3 and 2 respectively), the above code would fail to
find the second Predecessor as part of the critical path.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180824/a254e867/attachment.html>
More information about the llvm-bugs
mailing list