summaryrefslogtreecommitdiff
path: root/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-10-26 01:10:25 +0000
committerBill Wendling <isanbard@gmail.com>2011-10-26 01:10:25 +0000
commita823e3d42c48ceeb2f5011f7402031bf02fa0fe1 (patch)
treecca8249ff2fb83080f52d38fc37cbb85f52e2e4c /lib/CodeGen/BranchFolding.cpp
parent526e1bbe6b3f7baf0cb994f352110490cdc253e1 (diff)
downloadllvm-a823e3d42c48ceeb2f5011f7402031bf02fa0fe1.tar.gz
llvm-a823e3d42c48ceeb2f5011f7402031bf02fa0fe1.tar.bz2
llvm-a823e3d42c48ceeb2f5011f7402031bf02fa0fe1.tar.xz
Reapply r142920 with fix:
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> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143001 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/BranchFolding.cpp')
-rw-r--r--lib/CodeGen/BranchFolding.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp
index 75288b0934..5dec368112 100644
--- a/lib/CodeGen/BranchFolding.cpp
+++ b/lib/CodeGen/BranchFolding.cpp
@@ -870,6 +870,9 @@ bool BranchFolder::TailMergeBlocks(MachineFunction &MF) {
// Visit each predecessor only once.
if (!UniquePreds.insert(PBB))
continue;
+ // Skip blocks which may jump to a landing pad. Can't tail merge these.
+ if (PBB->getLandingPadSuccessor())
+ continue;
MachineBasicBlock *TBB = 0, *FBB = 0;
SmallVector<MachineOperand, 4> Cond;
if (!TII->AnalyzeBranch(*PBB, TBB, FBB, Cond, true)) {