diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h index 4b4db6bd608..8f2c3023890 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 ac926dc59a1..e3a60248895 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::iterator I = CalledFunctions.begin(), + E = CalledFunctions.end(); I != E; ++I) + if (*I == Callee) { + CalledFunctions.erase(I); + E = CalledFunctions.end(); + } +}