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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 30 06:53:06 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) {
----------------
nikic wrote:

Should this check HasDefaultResults or !DefaultIsReachable?

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


More information about the llvm-commits mailing list