[llvm] [SimplifyCFG] Don't use a mask for lookup tables generated from switches with an unreachable default case (PR #94468)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 5 22:48:10 PDT 2024


================
@@ -6895,8 +6895,9 @@ static bool SwitchToLookupTable(SwitchInst *SI, IRBuilder<> &Builder,
   for (PHINode *PHI : PHIs) {
     const ResultListTy &ResultList = ResultLists[PHI];
 
-    // If using a bitmask, use any value to fill the lookup table holes.
-    Constant *DV = NeedMask ? ResultLists[PHI][0].second : DefaultResults[PHI];
+    // Use any value to fill the lookup table holes.
+    Constant *DV = HolesHaveUndefinedResults ? ResultLists[PHI][0].second
----------------
DianQK wrote:

When the default branch is undefined, we can use a poison value. This can be done as another PR, as it requires modifying the constructor of `SwitchLookupTable`.

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


More information about the llvm-commits mailing list