diff options
author | Bill Wendling <isanbard@gmail.com> | 2011-08-26 21:18:55 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2011-08-26 21:18:55 +0000 |
commit | 51fb91c04c920703fbd4a67ac3f85c0971b2c5a5 (patch) | |
tree | 43b056c077a23105c429f34523f1e5c7d7f8c93f /lib/CodeGen/SjLjEHPrepare.cpp | |
parent | 2b568fb3ce0fa7a7ff3a01c83a0d04765214275c (diff) | |
download | llvm-51fb91c04c920703fbd4a67ac3f85c0971b2c5a5.tar.gz llvm-51fb91c04c920703fbd4a67ac3f85c0971b2c5a5.tar.bz2 llvm-51fb91c04c920703fbd4a67ac3f85c0971b2c5a5.tar.xz |
Split the landing pad block only if it's a critical edge. Also intelligently
split it in the other place where we're splitting critical edges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138658 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SjLjEHPrepare.cpp')
-rw-r--r-- | lib/CodeGen/SjLjEHPrepare.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/lib/CodeGen/SjLjEHPrepare.cpp b/lib/CodeGen/SjLjEHPrepare.cpp index ebed3d2b88..e18cbeaeb3 100644 --- a/lib/CodeGen/SjLjEHPrepare.cpp +++ b/lib/CodeGen/SjLjEHPrepare.cpp @@ -143,7 +143,19 @@ void SjLjEHPass::markInvokeCallSite(InvokeInst *II, int InvokeNo, // If the unwind edge has phi nodes, split the edge. if (isa<PHINode>(II->getUnwindDest()->begin())) { - SplitCriticalEdge(II, 1, this); + // FIXME: New EH - This if-condition will be always true in the new scheme. + if (II->getUnwindDest()->isLandingPad()) { + if (isCriticalEdge(II, 1)) { + SmallVector<BasicBlock*, 2> NewBBs; + SplitLandingPadPredecessors(II->getUnwindDest(), II->getParent(), + ".1", ".2", this, NewBBs); + LPadSuccMap[II] = *succ_begin(NewBBs[0]); + } else { + LPadSuccMap[II] = II->getUnwindDest(); + } + } else { + SplitCriticalEdge(II, 1, this); + } // If there are any phi nodes left, they must have a single predecessor. while (PHINode *PN = dyn_cast<PHINode>(II->getUnwindDest()->begin())) { @@ -194,10 +206,14 @@ splitLiveRangesAcrossInvokes(SmallVector<InvokeInst*,16> &Invokes) { // FIXME: New EH - This if-condition will be always true in the new scheme. if (II->getUnwindDest()->isLandingPad()) { - SmallVector<BasicBlock*, 2> NewBBs; - SplitLandingPadPredecessors(II->getUnwindDest(), II->getParent(), - ".1", ".2", this, NewBBs); - LPadSuccMap[II] = *succ_begin(NewBBs[0]); + if (isCriticalEdge(II, 1)) { + SmallVector<BasicBlock*, 2> NewBBs; + SplitLandingPadPredecessors(II->getUnwindDest(), II->getParent(), + ".1", ".2", this, NewBBs); + LPadSuccMap[II] = *succ_begin(NewBBs[0]); + } else { + LPadSuccMap[II] = II->getUnwindDest(); + } } else { SplitCriticalEdge(II, 1, this); } |