[llvm] [SimplifyCFG] Add optimization for switches of powers of two (PR #70977)
Antonio Frighetto via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 20 07:28:04 PDT 2025
https://github.com/antoniofrighetto commented:
I'd rather relax TTI cost check, num cases, and whether the default case is always unreachable here. I can't imagine computing trailing zeroes being slower than overall emitting a classic jump table and performing an indirect jump to it (on the general instance). In practice this transform does not seem to kick in: https://godbolt.org/z/Tnd59rfdW (so, the AArch64 backend favoured lowering the switch to a binary search tree, which may be better – GCC instead recently started featuring this optimization).
https://github.com/llvm/llvm-project/pull/70977
More information about the llvm-commits
mailing list