summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-09-08 11:05:51 +0000
committerDuncan Sands <baldrick@free.fr>2008-09-08 11:05:51 +0000
commit46911f12713adb757d359b497d4530f2cde08b06 (patch)
treeae49e21183a0a24da97417cb9d4533c2628f8f98 /llvm/lib/Transforms/Utils
parentca14c071752fdcdf5a431d6a35700db3f67953d9 (diff)
downloadbcm5719-llvm-46911f12713adb757d359b497d4530f2cde08b06.tar.gz
bcm5719-llvm-46911f12713adb757d359b497d4530f2cde08b06.zip
Reapply 55859. This doesn't change anything as
long as the callgraph is correct. It checks for wrong callgraphs more strictly. llvm-svn: 55894
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r--llvm/lib/Transforms/Utils/InlineFunction.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index cb9c28dcabb..b0e70bb89ad 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -143,16 +143,18 @@ static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock,
/// UpdateCallGraphAfterInlining - Once we have cloned code over from a callee
/// into the caller, update the specified callgraph to reflect the changes we
/// made. Note that it's possible that not all code was copied over, so only
-/// some edges of the callgraph will be remain.
-static void UpdateCallGraphAfterInlining(const Function *Caller,
- const Function *Callee,
+/// some edges of the callgraph may remain.
+static void UpdateCallGraphAfterInlining(CallSite CS,
Function::iterator FirstNewBlock,
DenseMap<const Value*, Value*> &ValueMap,
CallGraph &CG) {
+ const Function *Caller = CS.getInstruction()->getParent()->getParent();
+ const Function *Callee = CS.getCalledFunction();
+
// Update the call graph by deleting the edge from Callee to Caller
CallGraphNode *CalleeNode = CG[Callee];
CallGraphNode *CallerNode = CG[Caller];
- CallerNode->removeCallEdgeTo(CalleeNode);
+ CallerNode->removeCallEdgeFor(CS);
// Since we inlined some uninlined call sites in the callee into the caller,
// add edges from the caller to all of the callees of the callee.
@@ -302,8 +304,7 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) {
// Update the callgraph if requested.
if (CG)
- UpdateCallGraphAfterInlining(Caller, CalledFunc, FirstNewBlock, ValueMap,
- *CG);
+ UpdateCallGraphAfterInlining(CS, FirstNewBlock, ValueMap, *CG);
}
// If there are any alloca instructions in the block that used to be the entry
OpenPOWER on IntegriCloud