@@ -168,7 +168,7 @@ int SystemZPreRASchedStrategy::computeSULivenessScore(
168168
169169 // Before pulling down a load (to close the live range), the liveness of
170170 // the use operands is checked.
171- bool UsesLivePrio = false , UsesLiveAll = false ;
171+ bool UsesLive = false ;
172172 if (isRegDef (MO0)) {
173173 // Extract the PressureChanges that all fp/vector or GR64/GR32/GRH32 regs
174174 // affect respectively. misched-prera-pdiffs.mir tests against any future
@@ -188,22 +188,17 @@ int SystemZPreRASchedStrategy::computeSULivenessScore(
188188 int RegWeight = TRI->getRegClassWeight (RC).RegWeight ;
189189 bool PrioDefNoKill = PrioPressureChange == -RegWeight;
190190 bool GPRDefNoKill = GPRPressureChange == -RegWeight;
191- UsesLivePrio = (PrioDefNoKill || (!PrioPressureChange && GPRDefNoKill));
192- UsesLiveAll = (PrioDefNoKill && !GPRPressureChange) ||
193- (!PrioPressureChange && GPRDefNoKill);
191+ UsesLive = (PrioDefNoKill || (!PrioPressureChange && GPRDefNoKill));
194192 }
195193
196194 bool IsKillingStore = isStoreOfVReg (MI) &&
197195 !DAG->getBotRPTracker ().isRegLive (MO0.getReg ());
198196
199197 // Pull down a defining SU if it preserves the scheduled latency while not
200- // causing any (vector) registers to become live. If however there will be
201- // relatively many SUs scheduled above this one and all uses are already
202- // live it should not be a problem to increase the scheduled latency given
203- // the OOO execution.
204- // TODO: Try scheduling small (DFSResult) subtrees as a unit.
205- bool SchedLow = (PreservesSchedLat && UsesLivePrio) ||
206- (HasDistToTop && UsesLiveAll);
198+ // causing any (vector) registers to become live. It should also be ok if
199+ // there will be relatively many SUs scheduled above this one given the OOO
200+ // execution. TODO: Try scheduling small (DFSResult) subtrees as a unit.
201+ bool SchedLow = UsesLive && (PreservesSchedLat || HasDistToTop);
207202
208203 // This handles regions with many chained stores of the same depth at the
209204 // bottom in the input order (cactus). Push them upwards during scheduling.
@@ -239,12 +234,11 @@ bool SystemZPreRASchedStrategy::tryCandidate(SchedCandidate &Cand,
239234 return TryCand.Reason != NoCand;
240235 }
241236
242- if (TinyRegion) {
243- // Prioritize instructions that read unbuffered resources by stall cycles.
244- if (tryLess (Zone->getLatencyStallCycles (TryCand.SU ),
245- Zone->getLatencyStallCycles (Cand.SU ), TryCand, Cand, Stall))
246- return TryCand.Reason != NoCand;
247- } else {
237+ // Schedule for latency after first trying to reduce register
238+ // liveness. Don't do this with tiny regions: the input order is typically
239+ // fairly good generally and it doesn't seem like a good idea to move only
240+ // a few instructions around too much.
241+ if (!TinyRegion) {
248242 // Look for an opportunity to reduce register liveness.
249243 int TryCandScore = computeSULivenessScore (TryCand, DAG, Zone);
250244 int CandScore = computeSULivenessScore (Cand, DAG, Zone);
@@ -258,8 +252,8 @@ bool SystemZPreRASchedStrategy::tryCandidate(SchedCandidate &Cand,
258252 Zone->getScheduledLatency ())) {
259253 // Put the higher SU above only if its depth is less than what's remaining.
260254 unsigned HigherSUDepth = TryCand.SU ->getHeight () < Cand.SU ->getHeight ()
261- ? Cand.SU ->getDepth ()
262- : TryCand.SU ->getDepth ();
255+ ? Cand.SU ->getDepth ()
256+ : TryCand.SU ->getDepth ();
263257 if (HigherSUDepth != getRemLat (Zone) &&
264258 tryLess (TryCand.SU ->getHeight (), Cand.SU ->getHeight (), TryCand, Cand,
265259 GenericSchedulerBase::BotHeightReduce)) {
0 commit comments