[llvm] r327997 - [Hexagon] Check weak dependences when only 1 instruction is available
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 20 09:22:06 PDT 2018
Author: kparzysz
Date: Tue Mar 20 09:22:06 2018
New Revision: 327997
URL: http://llvm.org/viewvc/llvm-project?rev=327997&view=rev
Log:
[Hexagon] Check weak dependences when only 1 instruction is available
Patch by Brendon Cahoon.
Modified:
llvm/trunk/lib/Target/Hexagon/HexagonMachineScheduler.cpp
Modified: llvm/trunk/lib/Target/Hexagon/HexagonMachineScheduler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonMachineScheduler.cpp?rev=327997&r1=327996&r2=327997&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonMachineScheduler.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonMachineScheduler.cpp Tue Mar 20 09:22:06 2018
@@ -466,6 +466,10 @@ void ConvergingVLIWScheduler::VLIWSchedB
}
}
+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::VLIWSche
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::pressureCha
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;
More information about the llvm-commits
mailing list