aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-10-25 00:54:05 +0000
committerBill Wendling <isanbard@gmail.com>2011-10-25 00:54:05 +0000
commit38ced995f691952bb89ab9aa69f1e60b1acaa8b6 (patch)
tree1d66cc7271b96766423b095672999b04ec7b34a6 /llvm/lib/CodeGen/BranchFolding.cpp
parent841222ea75d8a27226aa20266c46888d53d79686 (diff)
downloadllvm-38ced995f691952bb89ab9aa69f1e60b1acaa8b6.zip
llvm-38ced995f691952bb89ab9aa69f1e60b1acaa8b6.tar.gz
llvm-38ced995f691952bb89ab9aa69f1e60b1acaa8b6.tar.bz2
An MBB which branches to an EH landing pad shouldn't be considered for tail merging.
In SjLj EH, the jump to the landing pad is not done explicitly through a branch statement. The EH landing pad is added as a successor to the throwing BB. Because of that however, the branch folding pass could mistakenly think that it could merge the throwing BB with another BB. This isn't safe to do. <rdar://problem/10334833> llvm-svn: 142891
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
-rw-r--r--llvm/lib/CodeGen/BranchFolding.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp
index 75288b0..2c39f64 100644
--- a/llvm/lib/CodeGen/BranchFolding.cpp
+++ b/llvm/lib/CodeGen/BranchFolding.cpp
@@ -913,7 +913,8 @@ bool BranchFolder::TailMergeBlocks(MachineFunction &MF) {
// reinsert conditional branch only, for now
TII->InsertBranch(*PBB, (TBB == IBB) ? FBB : TBB, 0, NewCond, dl);
}
- MergePotentials.push_back(MergePotentialsElt(HashEndOfMBB(PBB), *P));
+ if (!PBB->getLandingPadSuccessor())
+ MergePotentials.push_back(MergePotentialsElt(HashEndOfMBB(PBB),*P));
}
}
// If this is a large problem, avoid visiting the same basic blocks