[llvm] [SimplifyCFG] Enable icmp-to-switch for direct ret cases (PR #174473)

Jannik Glückert via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 5 13:10:25 PST 2026


Jannik2099 wrote:

Good spot, thanks.

That PR only applies to switch...case blocks / resulting icmps thereof that can be transformed to bitwise operations. It then does all the bit ops in IR.

My PR transforms any suitable icmp chain into a switch. Backends can then lower that into bit ops if possible.

So for operations that can be universally expressed as bit ops, that PR is indeed ideal. However, for all others, reordering an icmp chain to a switch is likely still beneficial as it's more accessible for other transformations / backend lowering.

Tldr: there's overlap, but I think my transformation solves a more general case. I'm currently building the PR and will compare results.

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


More information about the llvm-commits mailing list