summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-03-20 16:22:06 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-03-20 16:22:06 +0000
commit73be83dec5e4efa3f799c50f6bd95a9f4de99113 (patch)
tree632acb72a172e3d17fa3f1483f66cc6a0e2687c2 /llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp
parent9af71b38750328a110204c6e186e8d1e0dc6982f (diff)
downloadbcm5719-llvm-73be83dec5e4efa3f799c50f6bd95a9f4de99113.tar.gz
bcm5719-llvm-73be83dec5e4efa3f799c50f6bd95a9f4de99113.zip
[Hexagon] Check weak dependences when only 1 instruction is available
Patch by Brendon Cahoon. llvm-svn: 327997
Diffstat (limited to 'llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp')
-rw-r--r--llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp b/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp
index 8599c1a2b56..ddf9c4cb185 100644
--- a/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp
@@ -466,6 +466,10 @@ void ConvergingVLIWScheduler::VLIWSchedBoundary::removeReady(SUnit *SU) {
}
}
+static unsigned getWeakLeft(const SUnit *SU, bool IsTop) {
+ return (IsTop) ? SU->WeakPredsLeft : SU->WeakSuccsLeft;
+}
+
/// If this queue only has one ready candidate, return it. As a side effect,
/// advance the cycle until at least one node is ready. If multiple instructions
/// are ready, return NULL.
@@ -473,11 +477,15 @@ SUnit *ConvergingVLIWScheduler::VLIWSchedBoundary::pickOnlyChoice() {
if (CheckPending)
releasePending();
- for (unsigned i = 0;
- Available.empty() ||
- (Available.size() == 1 &&
- !ResourceModel->isResourceAvailable(*Available.begin(), isTop()));
- ++i) {
+ auto AdvanceCycle = [this]() {
+ if (Available.empty())
+ return true;
+ if (Available.size() == 1 && Pending.size() > 0)
+ return !ResourceModel->isResourceAvailable(*Available.begin(), isTop()) ||
+ getWeakLeft(*Available.begin(), isTop()) != 0;
+ return false;
+ };
+ for (unsigned i = 0; AdvanceCycle(); ++i) {
assert(i <= (HazardRec->getMaxLookAhead() + MaxMinLatency) &&
"permanent hazard"); (void)i;
ResourceModel->reserveResources(nullptr, isTop());
@@ -629,10 +637,6 @@ int ConvergingVLIWScheduler::pressureChange(const SUnit *SU, bool isBotUp) {
return 0;
}
-static unsigned getWeakLeft(const SUnit *SU, bool IsTop) {
- return (IsTop) ? SU->WeakPredsLeft : SU->WeakSuccsLeft;
-}
-
// Constants used to denote relative importance of
// heuristic components for cost computation.
static const unsigned PriorityOne = 200;
OpenPOWER on IntegriCloud