diff options
-rw-r--r-- | lib/CodeGen/CGCleanup.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/CGStmt.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/CodeGen/CGCleanup.cpp b/lib/CodeGen/CGCleanup.cpp index 645ef2520d..f586230301 100644 --- a/lib/CodeGen/CGCleanup.cpp +++ b/lib/CodeGen/CGCleanup.cpp @@ -502,9 +502,9 @@ static void destroyOptimisticNormalEntry(CodeGenFunction &CGF, // The only uses should be fixup switches. llvm::SwitchInst *si = cast<llvm::SwitchInst>(use.getUser()); - if (si->getNumCases() == 2 && si->getDefaultDest() == unreachableBB) { + if (si->getNumCases() == 1 && si->getDefaultDest() == unreachableBB) { // Replace the switch with a branch. - llvm::BranchInst::Create(si->getSuccessor(1), si); + llvm::BranchInst::Create(si->getCaseSuccessor(0), si); // The switch operand is a load from the cleanup-dest alloca. llvm::LoadInst *condition = cast<llvm::LoadInst>(si->getCondition()); diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index 97755e3906..c9311893ae 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -1221,7 +1221,7 @@ void CodeGenFunction::EmitSwitchStmt(const SwitchStmt &S) { // Update the default block in case explicit case range tests have // been chained on top. - SwitchInsn->setSuccessor(0, CaseRangeBlock); + SwitchInsn->setDefaultDest(CaseRangeBlock); // If a default was never emitted: if (!DefaultBlock->getParent()) { |