[llvm] [SimplifyCFG] Replace unreachable switch lookup table holes with poison (PR #94990)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 25 17:35:33 PDT 2024


================
@@ -6322,6 +6333,9 @@ SwitchLookupTable::SwitchLookupTable(
       if (!ConstVal) {
         // This is an undef. We could deal with it, but undefs in lookup tables
         // are very seldom. It's probably not worth the additional complexity.
+        // TODO: In switches with holes and an unreachable default branch, this
----------------
DianQK wrote:

I think you can set it to the first value here: https://github.com/llvm/llvm-project/blob/d75f9dd1d29b332bdc51346de63cbc04646354d7/llvm/lib/Transforms/Utils/SimplifyCFG.cpp#L6268. Your test cases reminded me that we can directly provide `undef`/`poison`, so this might not cause significant regressions. Others might have different opinions on this, so I'll request comments from them after you address the `poison` and `undef` mixing issue.

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


More information about the llvm-commits mailing list