aboutsummaryrefslogtreecommitdiffstats
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
commit86ed4089e367956ea7134dd7e99334a084fec6df (patch)
treed3b01488482e62d86d5393fb0e2e6c8fa836d5b9
parentfef5ff07c9f0b67148e5e3ac3e2aa2d309780682 (diff)
downloadexternal_llvm-86ed4089e367956ea7134dd7e99334a084fec6df.tar.gz
external_llvm-86ed4089e367956ea7134dd7e99334a084fec6df.tar.bz2
external_llvm-86ed4089e367956ea7134dd7e99334a084fec6df.zip
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@142891 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/BranchFolding.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp
index 75288b0934..2c39f64998 100644
--- a/lib/CodeGen/BranchFolding.cpp
+++ b/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