[llvm] [SimplifyCFG] Shrink integer lookup tables (PR #202071)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 6 13:45:53 PDT 2026


nikic wrote:

> I'm still somewhat new to these optimization things -- questions: does this need better legality checking than power of 2? Does this need cost model checking w.r.t. the cost of the zext?

I think this is fine without cost modelling.

> Is this a good place or should we rather to this in something like GlobalOpt (shrinking of general loads from local arrays with small values)?

Doing this in GlobalOpt does sound valuable in principle (I expect that overly wide lookup tables are fairly common, not just when generated by SimplifyCFG). But I don't think that we currently have a GlobalOpt run after we run SimplifyCFG with SwitchToLookupTable enabled.

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


More information about the llvm-commits mailing list