[llvm] [SimplifyCFG] Preserve !unpredictable when forming a switch (PR #221580)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 10:54:46 PDT 2026


aengelke wrote:

> is also well served by just how biased the branch weights are (idea being biased branches are predictable).

You can easily have a 50/50 branch that is extremely well predictable, e.g. when first used a lot in one direction and then a lot in the other, or when alternating, or when the direction correlates with a previous branch (branch predictions can depend on the global branch history). On the other hand, a 95/5 branch might be not predictable at all and, given how expensive branch misses can be, already benefit from a conversion into cmov (e.g. if the dependency chains are short enough). This information is not revealed when just considering edge counts.

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


More information about the llvm-commits mailing list