summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorJoseph Tremoulet <jotrem@microsoft.com>2015-09-27 01:47:46 +0000
committerJoseph Tremoulet <jotrem@microsoft.com>2015-09-27 01:47:46 +0000
commit09af67aba54e6d2a05e3071c0c7ba43bde678df9 (patch)
treeff8dfefbf81e9a6ae3f2f3ded3ade5b8a54b8ed7 /llvm/lib/CodeGen
parentd47346d0f8f0012c556e4ce656c4222eec8d08d6 (diff)
downloadbcm5719-llvm-09af67aba54e6d2a05e3071c0c7ba43bde678df9.tar.gz
bcm5719-llvm-09af67aba54e6d2a05e3071c0c7ba43bde678df9.zip
[EH] Create removeUnwindEdge utility
Summary: Factor the code that rewrites invokes to calls and rewrites WinEH terminators to their "unwind to caller" equivalents into a helper in Utils/Local, and use it in the three places I'm aware of that need to do this. Reviewers: andrew.w.kaylor, majnemer, rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D13152 llvm-svn: 248677
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/WinEHPrepare.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp
index d5af24ed71a..b062b1a29d3 100644
--- a/llvm/lib/CodeGen/WinEHPrepare.cpp
+++ b/llvm/lib/CodeGen/WinEHPrepare.cpp
@@ -3184,9 +3184,23 @@ void WinEHPrepare::removeImplausibleTerminators(Function &F) {
for (BasicBlock *SuccBB : TI->successors())
SuccBB->removePredecessor(BB);
+ if (IsUnreachableCleanupendpad) {
+ // We can't simply replace a cleanupendpad with unreachable, because
+ // its predecessor edges are EH edges and unreachable is not an EH
+ // pad. Change all predecessors to the "unwind to caller" form.
+ for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB);
+ PI != PE;) {
+ BasicBlock *Pred = *PI++;
+ removeUnwindEdge(Pred);
+ }
+ }
+
new UnreachableInst(BB->getContext(), TI);
TI->eraseFromParent();
}
+ // FIXME: Check for invokes/cleanuprets/cleanupendpads which unwind to
+ // implausible catchendpads (i.e. catchendpad not in immediate parent
+ // funclet).
}
}
}
OpenPOWER on IntegriCloud