summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-10-05 02:33:56 +0000
committerJohn McCall <rjmccall@apple.com>2010-10-05 02:33:56 +0000
commit0680e97465a5d0ef78fd71ea7b806d9df239b3ca (patch)
tree767b9336aae0b168696e8e8413b494f83b308445 /lib/CodeGen/CodeGenFunction.cpp
parent9e2213ddd5b3510fa48e3175e9d098db4224cc30 (diff)
downloadclang-0680e97465a5d0ef78fd71ea7b806d9df239b3ca.tar.gz
clang-0680e97465a5d0ef78fd71ea7b806d9df239b3ca.tar.bz2
clang-0680e97465a5d0ef78fd71ea7b806d9df239b3ca.tar.xz
If we're resolving all outstanding fixups, and there are multiple fixups
for the same destination, then we must potentially rewrite the initial branch of every fixup. Without this patch, a short-circuit check meant to prevent a switch case from being redundantly added was preventing later fixups from being processed. Fixes PR8175 (again). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115586 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index 5e301b5218..043195cecf 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -1340,11 +1340,9 @@ static void ResolveAllBranchFixups(CodeGenFunction &CGF,
llvm::SmallPtrSet<llvm::BasicBlock*, 4> CasesAdded;
for (unsigned I = 0, E = CGF.EHStack.getNumBranchFixups(); I != E; ++I) {
- // Skip this fixup if its destination isn't set or if we've
- // already treated it.
+ // Skip this fixup if its destination isn't set.
BranchFixup &Fixup = CGF.EHStack.getBranchFixup(I);
if (Fixup.Destination == 0) continue;
- if (!CasesAdded.insert(Fixup.Destination)) continue;
// If there isn't an OptimisticBranchBlock, then InitialBranch is
// still pointing directly to its destination; forward it to the
@@ -1361,6 +1359,9 @@ static void ResolveAllBranchFixups(CodeGenFunction &CGF,
Fixup.InitialBranch->setSuccessor(0, CleanupEntry);
}
+ // Don't add this case to the switch statement twice.
+ if (!CasesAdded.insert(Fixup.Destination)) continue;
+
Switch->addCase(CGF.Builder.getInt32(Fixup.DestinationIndex),
Fixup.Destination);
}