diff options
| author | Duncan Sands <baldrick@free.fr> | 2008-09-06 17:19:29 +0000 |
|---|---|---|
| committer | Duncan Sands <baldrick@free.fr> | 2008-09-06 17:19:29 +0000 |
| commit | 95c2a7848ad8579a4d551078cd36501b28ad935d (patch) | |
| tree | 36e37c0ae3d7bbbd793d980b48207d4151f9d813 /llvm/lib/Transforms/IPO/PruneEH.cpp | |
| parent | fc8c680b891083012eea7d032c5276e7e3fb64e2 (diff) | |
| download | bcm5719-llvm-95c2a7848ad8579a4d551078cd36501b28ad935d.tar.gz bcm5719-llvm-95c2a7848ad8579a4d551078cd36501b28ad935d.zip | |
When PruneEH turned an invoke into an ordinary
call (thus changing the call site) it didn't
inform the callgraph about this. But the
call site does matter - as shown by the testcase,
the callgraph become invalid after the inliner
ran (with an edge between two functions simply
missing), resulting in wrong deductions by
GlobalsModRef.
llvm-svn: 55872
Diffstat (limited to 'llvm/lib/Transforms/IPO/PruneEH.cpp')
| -rw-r--r-- | llvm/lib/Transforms/IPO/PruneEH.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/PruneEH.cpp b/llvm/lib/Transforms/IPO/PruneEH.cpp index 8fb904b1ea5..630768fbdcd 100644 --- a/llvm/lib/Transforms/IPO/PruneEH.cpp +++ b/llvm/lib/Transforms/IPO/PruneEH.cpp @@ -156,6 +156,9 @@ bool PruneEH::runOnSCC(const std::vector<CallGraphNode *> &SCC) { // function if we have invokes to non-unwinding functions or code after calls to // no-return functions. bool PruneEH::SimplifyFunction(Function *F) { + CallGraph &CG = getAnalysis<CallGraph>(); + CallGraphNode *CGN = CG[F]; + bool MadeChange = false; for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator())) @@ -174,6 +177,9 @@ bool PruneEH::SimplifyFunction(Function *F) { BasicBlock *UnwindBlock = II->getUnwindDest(); UnwindBlock->removePredecessor(II->getParent()); + // Fix up the call graph. + CGN->replaceCallSite(II, Call); + // Insert a branch to the normal destination right before the // invoke. BranchInst::Create(II->getNormalDest(), II); |

