From a2582da44dbe7204aac49cdaeccfd4e77ff7c408 Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Fri, 3 Oct 2008 07:36:09 +0000 Subject: Teach internalize to preserve the callgraph. Why? Because it was there! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56996 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/IPA/CallGraph.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/Analysis/IPA/CallGraph.cpp') diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp index fba1d00d48..5aac2968b2 100644 --- a/lib/Analysis/IPA/CallGraph.cpp +++ b/lib/Analysis/IPA/CallGraph.cpp @@ -282,6 +282,19 @@ void CallGraphNode::removeAnyCallEdgeTo(CallGraphNode *Callee) { } } +/// removeOneAbstractEdgeTo - Remove one edge associated with a null callsite +/// from this node to the specified callee function. +void CallGraphNode::removeOneAbstractEdgeTo(CallGraphNode *Callee) { + for (unsigned i = CalledFunctions.size(); ; --i) { + assert(i && "Cannot find callee to remove!"); + CallRecord &CR = CalledFunctions[i-1]; + if (CR.second == Callee && !CR.first.getInstruction()) { + CalledFunctions.erase(CalledFunctions.begin()+i-1); + return; + } + } +} + /// replaceCallSite - Make the edge in the node for Old CallSite be for /// New CallSite instead. Note that this method takes linear time, so it /// should be used sparingly. -- cgit v1.2.3