[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 18:22:11 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())) {
----------------
vfdff wrote:

Thank for the double confirming @nikic  @zmodem, so I won't check `optsize` based on above discussion.

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


More information about the llvm-commits mailing list