Skip to content

Commit f66d97f

Browse files
[Analysis] Remove unused functions in CallGraphNode (#127411)
The last uses of these functions were removed in: commit 58bc98c Author: Arthur Eubanks <[email protected]> Date: Fri Jul 12 10:02:50 2024 -0700
1 parent 785a5b4 commit f66d97f

File tree

2 files changed

+0
-59
lines changed

2 files changed

+0
-59
lines changed

llvm/include/llvm/Analysis/CallGraph.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ class CallGraph {
129129
return CallsExternalNode.get();
130130
}
131131

132-
/// Old node has been deleted, and New is to be used in its place, update the
133-
/// ExternalCallingNode.
134-
void ReplaceExternalCallEdge(CallGraphNode *Old, CallGraphNode *New);
135-
136132
//===---------------------------------------------------------------------
137133
// Functions to keep a call graph up to date with a function that has been
138134
// modified.
@@ -251,18 +247,6 @@ class CallGraphNode {
251247
CalledFunctions.pop_back();
252248
}
253249

254-
/// Removes the edge in the node for the specified call site.
255-
///
256-
/// Note that this method takes linear time, so it should be used sparingly.
257-
void removeCallEdgeFor(CallBase &Call);
258-
259-
/// Removes all call edges from this node to the specified callee
260-
/// function.
261-
///
262-
/// This takes more time to execute than removeCallEdgeTo, so it should not
263-
/// be used unless necessary.
264-
void removeAnyCallEdgeTo(CallGraphNode *Callee);
265-
266250
/// Removes one edge associated with a null callsite from this node to
267251
/// the specified callee function.
268252
void removeOneAbstractEdgeTo(CallGraphNode *Callee);

llvm/lib/Analysis/CallGraph.cpp

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,6 @@ void CallGraph::print(raw_ostream &OS) const {
138138
LLVM_DUMP_METHOD void CallGraph::dump() const { print(dbgs()); }
139139
#endif
140140

141-
void CallGraph::ReplaceExternalCallEdge(CallGraphNode *Old,
142-
CallGraphNode *New) {
143-
for (auto &CR : ExternalCallingNode->CalledFunctions)
144-
if (CR.second == Old) {
145-
CR.second->DropRef();
146-
CR.second = New;
147-
CR.second->AddRef();
148-
}
149-
}
150-
151141
// removeFunctionFromModule - Unlink the function from this module, returning
152142
// it. Because this removes the function from the module, the call graph node
153143
// is destroyed. This is only valid if the function does not call any other
@@ -203,39 +193,6 @@ void CallGraphNode::print(raw_ostream &OS) const {
203193
LLVM_DUMP_METHOD void CallGraphNode::dump() const { print(dbgs()); }
204194
#endif
205195

206-
/// removeCallEdgeFor - This method removes the edge in the node for the
207-
/// specified call site. Note that this method takes linear time, so it
208-
/// should be used sparingly.
209-
void CallGraphNode::removeCallEdgeFor(CallBase &Call) {
210-
for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) {
211-
assert(I != CalledFunctions.end() && "Cannot find callsite to remove!");
212-
if (I->first && *I->first == &Call) {
213-
I->second->DropRef();
214-
*I = CalledFunctions.back();
215-
CalledFunctions.pop_back();
216-
217-
// Remove all references to callback functions if there are any.
218-
forEachCallbackFunction(Call, [=](Function *CB) {
219-
removeOneAbstractEdgeTo(CG->getOrInsertFunction(CB));
220-
});
221-
return;
222-
}
223-
}
224-
}
225-
226-
// removeAnyCallEdgeTo - This method removes any call edges from this node to
227-
// the specified callee function. This takes more time to execute than
228-
// removeCallEdgeTo, so it should not be used unless necessary.
229-
void CallGraphNode::removeAnyCallEdgeTo(CallGraphNode *Callee) {
230-
for (unsigned i = 0, e = CalledFunctions.size(); i != e; ++i)
231-
if (CalledFunctions[i].second == Callee) {
232-
Callee->DropRef();
233-
CalledFunctions[i] = CalledFunctions.back();
234-
CalledFunctions.pop_back();
235-
--i; --e;
236-
}
237-
}
238-
239196
/// removeOneAbstractEdgeTo - Remove one edge associated with a null callsite
240197
/// from this node to the specified callee function.
241198
void CallGraphNode::removeOneAbstractEdgeTo(CallGraphNode *Callee) {

0 commit comments

Comments
 (0)