Allow for switch with no cases. Was causing fault
authorDale Johannesen <dalej@apple.com>
Fri, 23 May 2008 01:01:31 +0000 (01:01 +0000)
committerDale Johannesen <dalej@apple.com>
Fri, 23 May 2008 01:01:31 +0000 (01:01 +0000)
in gcc.dg/pr27531-1.c.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51464 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/SCCP.cpp

index 9c17b77954e2b4bc066d9f8d001fae4d89511fe5..79cda33f79319888d7e1874a2acf9cb4b24515a5 100644 (file)
@@ -1379,6 +1379,8 @@ bool SCCPSolver::ResolvedUndefsIn(Function &F) {
       if (!getValueState(BI->getCondition()).isUndefined())
         continue;
     } else if (SwitchInst *SI = dyn_cast<SwitchInst>(TI)) {
+      if (SI->getNumSuccessors()<2)   // no cases
+        continue;
       if (!getValueState(SI->getCondition()).isUndefined())
         continue;
     } else {