diff options
author | Chris Lattner <sabre@nondot.org> | 2006-01-14 20:09:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-01-14 20:09:18 +0000 |
commit | f6d6823f0976181908780d825390b1a1a4931574 (patch) | |
tree | b6287d4920aaa1456ff8bcdda62c2e60b9c1f6c4 /llvm/lib/Transforms/IPO/Inliner.cpp | |
parent | 0841fb1d4c3ef3383b23775127019a736fc89360 (diff) | |
download | bcm5719-llvm-f6d6823f0976181908780d825390b1a1a4931574.tar.gz bcm5719-llvm-f6d6823f0976181908780d825390b1a1a4931574.zip |
Let the inliner update the callgraph to reflect the changes it makes, instead
of doing it ourselves. This fixes Transforms/Inline/2006-01-14-CallGraphUpdate.ll
llvm-svn: 25321
Diffstat (limited to 'llvm/lib/Transforms/IPO/Inliner.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/Inliner.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp index a10879a1507..2ee84276e76 100644 --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -42,18 +42,7 @@ static bool InlineCallIfPossible(CallSite CS, CallGraph &CG, const std::set<Function*> &SCCFunctions) { Function *Caller = CS.getInstruction()->getParent()->getParent(); Function *Callee = CS.getCalledFunction(); - if (!InlineFunction(CS)) return false; - - // Update the call graph by deleting the edge from Callee to Caller - CallGraphNode *CalleeNode = CG[Callee]; - CallGraphNode *CallerNode = CG[Caller]; - CallerNode->removeCallEdgeTo(CalleeNode); - - // Since we inlined all uninlined call sites in the callee into the caller, - // add edges from the caller to all of the callees of the callee. - for (CallGraphNode::iterator I = CalleeNode->begin(), - E = CalleeNode->end(); I != E; ++I) - CallerNode->addCalledFunction(*I); + if (!InlineFunction(CS, &CG)) return false; // If we inlined the last possible call site to the function, delete the // function body now. @@ -63,6 +52,7 @@ static bool InlineCallIfPossible(CallSite CS, CallGraph &CG, << Callee->getName() << "\n"); // Remove any call graph edges from the callee to its callees. + CallGraphNode *CalleeNode = CG[Callee]; while (CalleeNode->begin() != CalleeNode->end()) CalleeNode->removeCallEdgeTo(*(CalleeNode->end()-1)); |