[llvm-commits] [llvm] r138658 - /llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp
Bill Wendling
isanbard at gmail.com
Fri Aug 26 14:18:55 PDT 2011
Author: void
Date: Fri Aug 26 16:18:55 2011
New Revision: 138658
URL: http://llvm.org/viewvc/llvm-project?rev=138658&view=rev
Log:
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.
Modified:
llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp
Modified: llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp?rev=138658&r1=138657&r2=138658&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp Fri Aug 26 16:18:55 2011
@@ -143,7 +143,19 @@
// 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 @@
// 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);
}
More information about the llvm-commits
mailing list