[PATCH] D122485: [SimplifyCFG] Fold mutil cases to And mask

chenglin.bi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 25 08:31:07 PDT 2022


bcl5980 created this revision.
bcl5980 added reviewers: spatel, lebedev.ri, nikic, RKSimon, craig.topper.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
bcl5980 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

When switch with 2^n cases go to one result, check if the 2^n cases can be covered by n bit masks.
If yes we can use "and condition, ~mask" to simplify the switch

Fix one case of https://github.com/llvm/llvm-project/issues/39957


https://reviews.llvm.org/D122485

Files:
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp
  llvm/test/Transforms/SimplifyCFG/switch-to-select-two-case.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122485.418231.patch
Type: text/x-patch
Size: 7166 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220325/b704d948/attachment.bin>


More information about the llvm-commits mailing list