[llvm] [SimplifyCFG] Delete the unnecessary range check for small mask operation (PR #65835)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 17 09:08:27 PDT 2023
================
@@ -6545,6 +6544,17 @@ static bool SwitchToLookupTable(SwitchInst *SI, IRBuilder<> &Builder,
BranchInst *RangeCheckBranch = nullptr;
+ if (UseSwitchConditionAsTableIndex) {
+ ConstantRange CR = computeConstantRange(TableIndex, /* ForSigned */ false);
+ if (DL.fitsInLegalInteger(CR.getUpper().getLimitedValue())) {
----------------
zmodem wrote:
Oh I see. Yes, if you want to do this only for the "bit field lookup tables", then checking `WouldFitInRegister` makes sense, and I wouldn't worry about size.
But maybe we should do this for tables in general? Consider: https://godbolt.org/z/3qnE45YWj
https://github.com/llvm/llvm-project/pull/65835
More information about the llvm-commits
mailing list