[llvm] [LoopUnroll] Fix freqs for unconditional latches: N>2, fast (PR #182404)

Joel E. Denny via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 18:16:12 PDT 2026


================
@@ -625,13 +639,120 @@ static void fixProbContradiction(UnrollLoopOptions ULO,
     return Prob;
   };
 
+  // Compute the probability required at CondLatches[ComputeIdx] to get as close
+  // as possible to FreqDesired without replacing probabilities elsewhere in
+  // CondLatches.  Return {Prob, Freq} where 0 <= Prob <= 1 and Freq is the new
+  // frequency.
+  auto ComputeProb = [&](unsigned ComputeIdx) -> std::pair<double, double> {
+    assert(ComputeIdx < CondLatches.size());
----------------
jdenny-ornl wrote:

Done.

https://github.com/llvm/llvm-project/pull/182404


More information about the llvm-commits mailing list