[llvm] [SimplifyCFG] Extend `simplifySwitchOfPowersOfTwo` to reachable defaults (PR #161807)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 06:55:57 PST 2025


antoniofrighetto wrote:

> Nice!
> 
> I worry that `Intrinsic::ctpop` is expensive on targets without a popcount instruction though, such as older x86 and arm without neon support.
> 
> Maybe the code should check `TargetTransformInfo::getIntrinsicInstrCost()` first?

I believe the premise here should be that the backend can expand the intrinsic into a sequence of cheap checks when `ctpop` is not available (e.g., https://godbolt.org/z/z8ej6es5b).

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


More information about the llvm-commits mailing list