aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineScheduler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineScheduler.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index ba54324..556f003 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -2331,20 +2331,24 @@ SchedBoundary::getNextResourceCycle(const MCSchedClassDesc *SC, unsigned PIdx,
"Cannot have zero instances of a ProcResource");
if (isUnbufferedGroup(PIdx)) {
- // If any subunits are used by the instruction, report that the resource
- // group is available at 0, effectively removing the group record from
- // hazarding and basing the hazarding decisions on the subunit records.
- // Otherwise, choose the first available instance from among the subunits.
- // Specifications which assign cycles to both the subunits and the group or
- // which use an unbuffered group with buffered subunits will appear to
- // schedule strangely. In the first case, the additional cycles for the
- // group will be ignored. In the second, the group will be ignored
- // entirely.
+ // If any subunits are used by the instruction, report that the
+ // subunits of the resource group are available at the first cycle
+ // in which the unit is available, effectively removing the group
+ // record from hazarding and basing the hazarding decisions on the
+ // subunit records. Otherwise, choose the first available instance
+ // from among the subunits. Specifications which assign cycles to
+ // both the subunits and the group or which use an unbuffered
+ // group with buffered subunits will appear to schedule
+ // strangely. In the first case, the additional cycles for the
+ // group will be ignored. In the second, the group will be
+ // ignored entirely.
for (const MCWriteProcResEntry &PE :
make_range(SchedModel->getWriteProcResBegin(SC),
SchedModel->getWriteProcResEnd(SC)))
if (ResourceGroupSubUnitMasks[PIdx][PE.ProcResourceIdx])
- return std::make_pair(0u, StartIndex);
+ return std::make_pair(
+ getNextResourceCycleByInstance(StartIndex, Cycles, StartAtCycle),
+ StartIndex);
auto SubUnits = SchedModel->getProcResource(PIdx)->SubUnitsIdxBegin;
for (unsigned I = 0, End = NumberOfInstances; I < End; ++I) {