[llvm] [SimplifyCFG][profcheck] Synthesize profile for `br (X == 0 | X == 1), T, F1 -> switch` (PR #161549)

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 3 19:12:44 PDT 2025


================
@@ -5220,6 +5225,17 @@ bool SimplifyCFGOpt::simplifyBranchOnICmpChain(BranchInst *BI,
 
   // Create the new switch instruction now.
   SwitchInst *New = Builder.CreateSwitch(CompVal, DefaultBB, Values.size());
+  if (HasProfile) {
+    // We know the weight of the default case. We don't know the weight of the
+    // other cases, but rather than completely loose profiling info, we split
----------------
mtrofin wrote:

damnit, every-single-time! :)

thanks!

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


More information about the llvm-commits mailing list