[llvm] [SLU][profcheck] Estimate branch weights in partial unswitch cases (PR #164035)

Joel E. Denny via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 23 11:26:54 PDT 2025


================
@@ -271,10 +278,33 @@ static bool areLoopExitPHIsLoopInvariant(const Loop &L,
 /// Copy a set of loop invariant values \p ToDuplicate and insert them at the
 /// end of \p BB and conditionally branch on the copied condition. We only
 /// branch on a single value.
+/// We attempt to estimate the profile of the resulting conditional branch from
+/// \p ComputeProfFrom, which is the original conditional branch we're
+/// unswitching.
 static void buildPartialUnswitchConditionalBranch(
----------------
jdenny-ornl wrote:

The `buildPartialUnswitchConditionalBranch` header comments above have no description of what `Direction` generally means, and it took me some time to understand it.  Given that you have already worked on a specific discussion of `Direction` below for the case of probability calculations, could you also please add a general description of `Direction` above?

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


More information about the llvm-commits mailing list