[llvm] Reland [SimplifyCFG] Delete the unnecessary range check for small mask operation (PR #70542)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 30 08:37:10 PDT 2023


================
@@ -6631,6 +6630,27 @@ static bool SwitchToLookupTable(SwitchInst *SI, IRBuilder<> &Builder,
 
   BranchInst *RangeCheckBranch = nullptr;
 
+  // Grow the table to cover all possible index values to avoid the range check.
+  // It will use the default result to fill in the table hole later, so make
+  // sure it exist.
+  if (UseSwitchConditionAsTableIndex && HasDefaultResults) {
----------------
vfdff wrote:

hi @nikic , I think your intention  is  `DefaultIsReachable && HasDefaultResults` ? 
If so, I think it is more accurate to match above clarification.

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


More information about the llvm-commits mailing list