[llvm] [InstCombine] Canonicalize `switch(X << C)` into `switch(X)` (PR #77068)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 06:00:37 PST 2024


dtcxzyw wrote:

> I think it would make sense for the not-one-use case to check if the switch is dense enough for a jump table. In that case, the transformation should always be a win

It has been handled by `ReduceSwitchRange` in `SimplifyCFG`. The motivation of this patch is to handle this pattern without the constraint `SI->getNumCases() < 4` (The threshold will be target-specific in future. See also @nikic's comment https://github.com/llvm/llvm-project/pull/70977/files#r1394070233). So I think keeping it conservative makes sense.


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


More information about the llvm-commits mailing list