-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Analysis] Remove unused functions in CallGraphNode #127411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_001_remove_llvm_Analysis_ReplaceExternalCallEdge
Feb 18, 2025
Merged
[Analysis] Remove unused functions in CallGraphNode #127411
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_001_remove_llvm_Analysis_ReplaceExternalCallEdge
Feb 18, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
@llvm/pr-subscribers-llvm-analysis Author: Kazu Hirata (kazutakahirata) ChangesThe last uses of these functions were removed in: commit 58bc98c Full diff: https://github.com/llvm/llvm-project/pull/127411.diff 2 Files Affected:
diff --git a/llvm/include/llvm/Analysis/CallGraph.h b/llvm/include/llvm/Analysis/CallGraph.h
index f5ce2322b76d9..7f977db161c20 100644
--- a/llvm/include/llvm/Analysis/CallGraph.h
+++ b/llvm/include/llvm/Analysis/CallGraph.h
@@ -129,10 +129,6 @@ class CallGraph {
return CallsExternalNode.get();
}
- /// Old node has been deleted, and New is to be used in its place, update the
- /// ExternalCallingNode.
- void ReplaceExternalCallEdge(CallGraphNode *Old, CallGraphNode *New);
-
//===---------------------------------------------------------------------
// Functions to keep a call graph up to date with a function that has been
// modified.
@@ -251,18 +247,6 @@ class CallGraphNode {
CalledFunctions.pop_back();
}
- /// Removes the edge in the node for the specified call site.
- ///
- /// Note that this method takes linear time, so it should be used sparingly.
- void removeCallEdgeFor(CallBase &Call);
-
- /// Removes all 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);
-
/// Removes one edge associated with a null callsite from this node to
/// the specified callee function.
void removeOneAbstractEdgeTo(CallGraphNode *Callee);
diff --git a/llvm/lib/Analysis/CallGraph.cpp b/llvm/lib/Analysis/CallGraph.cpp
index ed9cd84bb8e9b..01344ee154fa5 100644
--- a/llvm/lib/Analysis/CallGraph.cpp
+++ b/llvm/lib/Analysis/CallGraph.cpp
@@ -138,16 +138,6 @@ void CallGraph::print(raw_ostream &OS) const {
LLVM_DUMP_METHOD void CallGraph::dump() const { print(dbgs()); }
#endif
-void CallGraph::ReplaceExternalCallEdge(CallGraphNode *Old,
- CallGraphNode *New) {
- for (auto &CR : ExternalCallingNode->CalledFunctions)
- if (CR.second == Old) {
- CR.second->DropRef();
- CR.second = New;
- CR.second->AddRef();
- }
-}
-
// removeFunctionFromModule - Unlink the function from this module, returning
// it. Because this removes the function from the module, the call graph node
// 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 {
LLVM_DUMP_METHOD void CallGraphNode::dump() const { print(dbgs()); }
#endif
-/// removeCallEdgeFor - This method removes the edge in the node for the
-/// specified call site. Note that this method takes linear time, so it
-/// should be used sparingly.
-void CallGraphNode::removeCallEdgeFor(CallBase &Call) {
- for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) {
- assert(I != CalledFunctions.end() && "Cannot find callsite to remove!");
- if (I->first && *I->first == &Call) {
- I->second->DropRef();
- *I = CalledFunctions.back();
- CalledFunctions.pop_back();
-
- // Remove all references to callback functions if there are any.
- forEachCallbackFunction(Call, [=](Function *CB) {
- removeOneAbstractEdgeTo(CG->getOrInsertFunction(CB));
- });
- return;
- }
- }
-}
-
-// 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 (unsigned i = 0, e = CalledFunctions.size(); i != e; ++i)
- if (CalledFunctions[i].second == Callee) {
- Callee->DropRef();
- CalledFunctions[i] = CalledFunctions.back();
- CalledFunctions.pop_back();
- --i; --e;
- }
-}
-
/// removeOneAbstractEdgeTo - Remove one edge associated with a null callsite
/// from this node to the specified callee function.
void CallGraphNode::removeOneAbstractEdgeTo(CallGraphNode *Callee) {
|
aeubanks
approved these changes
Feb 18, 2025
wldfngrs
pushed a commit
to wldfngrs/llvm-project
that referenced
this pull request
Feb 19, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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