Skip to content

Commit 6d889bd

Browse files
committed
Simplify detection of a killing store (NFC).
1 parent bcb2e3a commit 6d889bd

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

llvm/lib/Target/SystemZ/SystemZMachineScheduler.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -227,19 +227,20 @@ int SystemZPreRASchedStrategy::computeSULivenessScore(
227227
const MachineOperand &MO0 = MI->getOperand(0);
228228
assert(!isPhysRegDef(MO0) && "Did not expect physreg def!");
229229
bool IsLoad = isRegDef(MO0) && !MO0.isDead() && !IsRedefining[SU->NodeNum];
230-
bool IsStore = isStoreOfVReg(MI);
231230
bool PreservesSchedLat = SU->getHeight() <= Zone->getScheduledLatency();
232231
const unsigned Cycles = 2;
233232
unsigned Margin = SchedModel->getIssueWidth() * (Cycles + SU->Latency - 1);
234233
bool HasDistToTop = NumLeft > Margin;
234+
bool IsKillingStore = isStoreOfVReg(MI) &&
235+
!DAG->getBotRPTracker().isRegLive(MO0.getReg());
235236

236237
// Before pulling down a load (to close the live range), the liveness of
237238
// the other operands are checked: only if no use register would become
238239
// live is the load pulled down. This can be checked either by looking at
239240
// the operands of MI and checking if the reg is live, or the PDiff of the
240241
// SU can be used to infer the same answers. Both methods seem to give the
241242
// same identical result, at least when building the benchmarks.
242-
bool UsesLivePrio = false, UsesLiveAll = false, StoreKill = false;
243+
bool UsesLivePrio = false, UsesLiveAll = false;
243244
if (!WITHPDIFFS) {
244245
// Find uses of registers that are not already live (kills).
245246
bool PrioKill = false;
@@ -263,7 +264,6 @@ int SystemZPreRASchedStrategy::computeSULivenessScore(
263264
UsesLivePrio = IsLoad && !PrioKill &&
264265
(isPrioVirtReg(MO0.getReg(), &DAG->MRI) || !GPRKill);
265266
UsesLiveAll = !PrioKill && !GPRKill;
266-
StoreKill = (PrioKill || (!HasPrioUse && GPRKill));
267267
} else if (MO0.isReg() && MO0.getReg().isVirtual()) {
268268
int PrioPressureChange = 0;
269269
int GPRPressureChange = 0;
@@ -284,11 +284,6 @@ int SystemZPreRASchedStrategy::computeSULivenessScore(
284284
UsesLivePrio = (PrioDefNoKill || (!PrioPressureChange && GPRDefNoKill));
285285
UsesLiveAll = (PrioDefNoKill && !GPRPressureChange) ||
286286
(!PrioPressureChange && GPRDefNoKill);
287-
} else if (IsStore && FirstStoreInGroupScheduled && StoresGroup.count(SU)) {
288-
bool SrcKill = !DAG->getBotRPTracker().isRegLive(MO0.getReg());
289-
StoreKill =
290-
SrcKill && (PrioPressureChange == RegWeight ||
291-
(!PrioPressureChange && GPRPressureChange == RegWeight));
292287
}
293288
}
294289

@@ -303,8 +298,8 @@ int SystemZPreRASchedStrategy::computeSULivenessScore(
303298

304299
// This handles regions with many chained stores of the same depth at the
305300
// bottom in the input order (cactus). Push them upwards during scheduling.
306-
bool SchedHigh = IsStore && FirstStoreInGroupScheduled &&
307-
StoresGroup.count(SU) && StoreKill;
301+
bool SchedHigh = IsKillingStore && FirstStoreInGroupScheduled &&
302+
StoresGroup.count(SU);
308303

309304
if (SchedLow)
310305
return -1;

0 commit comments

Comments
 (0)