@@ -127,7 +127,11 @@ bool SystemZPreRASchedStrategy::shouldReduceLatency(SchedBoundary *Zone) const {
127127
128128 if (PreRALatRed == SystemZSched::More)
129129 return true ;
130+
130131 if (PreRALatRed == SystemZSched::Heuristics)
132+ // Don't extend the scheduled latency in regions with many nodes in data
133+ // sequences, or for (single block loop) regions that are acyclically
134+ // (within a single loop iteration) latency limited.
131135 return HasDataSequences || Rem.IsAcyclicLatencyLimited ;
132136
133137 if (PreRALatRed == SystemZSched::CycleBased) {
@@ -343,13 +347,12 @@ bool SystemZPreRASchedStrategy::tryCandidate(SchedCandidate &Cand,
343347 if (tryLess (TryCandScore, CandScore, TryCand, Cand, LivenessReduce))
344348 return TryCand.Reason != NoCand;
345349
346- // Don't extend the scheduled latency in regions with many nodes in
347- // simple data sequences, or for (single block loop) regions that are
348- // acyclically (within a single loop iteration) latency limited.
350+ // Avoid increasing the scheduled latency.
349351 if (shouldReduceLatency (Zone) &&
350352 TryCand.SU ->getHeight () != Cand.SU ->getHeight () &&
351353 (std::max (TryCand.SU ->getHeight (), Cand.SU ->getHeight ()) >
352354 Zone->getScheduledLatency ())) {
355+ // Put the higher SU above only if its depth is less than what's remaining.
353356 unsigned HigherSUDepth = TryCand.SU ->getHeight () < Cand.SU ->getHeight ()
354357 ? Cand.SU ->getDepth ()
355358 : TryCand.SU ->getDepth ();
0 commit comments