aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Analysis/CallGraph.h5
-rw-r--r--lib/Analysis/IPA/CallGraph.cpp12
2 files changed, 17 insertions, 0 deletions
diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h
index 4b4db6bd60..8f2c302389 100644
--- a/include/llvm/Analysis/CallGraph.h
+++ b/include/llvm/Analysis/CallGraph.h
@@ -251,6 +251,11 @@ public:
/// used sparingly.
void removeCallEdgeTo(CallGraphNode *Callee);
+ /// removeAnyCallEdgeTo - This method removes any call edges from this node to
+ /// the specified callee function. This takes more time to execute than
+ /// removeCallEdgeTo, so it should not be used unless necessary.
+ void removeAnyCallEdgeTo(CallGraphNode *Callee);
+
private: // Stuff to construct the node, used by CallGraph
friend class CallGraph;
diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp
index ac926dc59a..e3a6024889 100644
--- a/lib/Analysis/IPA/CallGraph.cpp
+++ b/lib/Analysis/IPA/CallGraph.cpp
@@ -206,3 +206,15 @@ void CallGraphNode::removeCallEdgeTo(CallGraphNode *Callee) {
}
}
}
+
+// removeAnyCallEdgeTo - This method removes any call edges from this node to
+// the specified callee function. This takes more time to execute than
+// removeCallEdgeTo, so it should not be used unless necessary.
+void CallGraphNode::removeAnyCallEdgeTo(CallGraphNode *Callee) {
+ for (std::vector<CallGraphNode*>::iterator I = CalledFunctions.begin(),
+ E = CalledFunctions.end(); I != E; ++I)
+ if (*I == Callee) {
+ CalledFunctions.erase(I);
+ E = CalledFunctions.end();
+ }
+}