[llvm] [CVP] Check whether the default case is reachable (PR #79993)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 04:59:10 PST 2024


================
@@ -407,6 +408,35 @@ static bool processSwitch(SwitchInst *I, LazyValueInfo *LVI,
 
       // Increment the case iterator since we didn't delete it.
       ++CI;
+      ++ReachableCaseCount;
+    }
+
+    BasicBlock *DefaultDest = SI->getDefaultDest();
+    if (!isa<UnreachableInst>(DefaultDest->getFirstNonPHIOrDbg())) {
----------------
nikic wrote:

I think it would be best to avoid this code if we already determined the only destination above.

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


More information about the llvm-commits mailing list