diff options
author | Reid Kleckner <reid@kleckner.net> | 2015-02-11 01:23:16 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2015-02-11 01:23:16 +0000 |
commit | 96d011315aa01de179897eaf4e7baeddc5de1cda (patch) | |
tree | ccced202122ff25d6362be653140bfe079ab5925 /llvm/lib/Transforms/IPO/PruneEH.cpp | |
parent | 58e985c2db3045f1416520212108f93c8c257b18 (diff) | |
download | bcm5719-llvm-96d011315aa01de179897eaf4e7baeddc5de1cda.tar.gz bcm5719-llvm-96d011315aa01de179897eaf4e7baeddc5de1cda.zip |
Don't promote asynch EH invokes of nounwind functions to calls
If the landingpad of the invoke is using a personality function that
catches asynch exceptions, then it can catch a trap.
Also add some landingpads to invalid LLVM IR test cases that lack them.
Over-the-shoulder reviewed by David Majnemer.
llvm-svn: 228782
Diffstat (limited to 'llvm/lib/Transforms/IPO/PruneEH.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/PruneEH.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/PruneEH.cpp b/llvm/lib/Transforms/IPO/PruneEH.cpp index 7bd4ce12860..1943b930cbf 100644 --- a/llvm/lib/Transforms/IPO/PruneEH.cpp +++ b/llvm/lib/Transforms/IPO/PruneEH.cpp @@ -18,8 +18,10 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" +#include "llvm/Support/raw_ostream.h" #include "llvm/Analysis/CallGraph.h" #include "llvm/Analysis/CallGraphSCCPass.h" +#include "llvm/Analysis/LibCallSemantics.h" #include "llvm/IR/CFG.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Function.h" @@ -175,7 +177,7 @@ bool PruneEH::SimplifyFunction(Function *F) { bool MadeChange = false; for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator())) - if (II->doesNotThrow()) { + if (II->doesNotThrow() && canSimplifyInvokeNoUnwind(II)) { SmallVector<Value*, 8> Args(II->op_begin(), II->op_end() - 3); // Insert a call instruction before the invoke. CallInst *Call = CallInst::Create(II->getCalledValue(), Args, "", II); |