[llvm] 389a69b - [Analysis] Remove unused CallGraphSCC methods (NFC) (#229683)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 7 01:28:19 PDT 2026
Author: Kazu Hirata
Date: 2026-10-07T08:28:09Z
New Revision: 389a69b468631086349b03ff3abc1cff9df71db0
URL: https://github.com/llvm/llvm-project/commit/389a69b468631086349b03ff3abc1cff9df71db0
DIFF: https://github.com/llvm/llvm-project/commit/389a69b468631086349b03ff3abc1cff9df71db0.diff
LOG: [Analysis] Remove unused CallGraphSCC methods (NFC) (#229683)
The last callers of CallGraphSCC::ReplaceNode and
CallGraphSCC::DeleteNode were removed on July 12, 2024 in commit
58bc98cd3abd72226cdbaa05bd92af9598d491db.
Their removal leaves the private member variable Context unused, so this
patch also removes Context and simplifies the CallGraphSCC constructor.
Assisted-by: Antigravity
Added:
Modified:
llvm/include/llvm/Analysis/CallGraphSCCPass.h
llvm/lib/Analysis/CallGraphSCCPass.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/CallGraphSCCPass.h b/llvm/include/llvm/Analysis/CallGraphSCCPass.h
index 4ef38cbbcbd64..c620c08859055 100644
--- a/llvm/include/llvm/Analysis/CallGraphSCCPass.h
+++ b/llvm/include/llvm/Analysis/CallGraphSCCPass.h
@@ -82,11 +82,10 @@ class LLVM_ABI CallGraphSCCPass : public Pass {
/// CallGraphSCC - This is a single SCC that a CallGraphSCCPass is run on.
class CallGraphSCC {
const CallGraph &CG; // The call graph for this SCC.
- void *Context; // The CGPassManager object that is vending this.
std::vector<CallGraphNode *> Nodes;
public:
- CallGraphSCC(CallGraph &cg, void *context) : CG(cg), Context(context) {}
+ CallGraphSCC(CallGraph &cg) : CG(cg) {}
void initialize(ArrayRef<CallGraphNode *> NewNodes) {
Nodes.assign(NewNodes.begin(), NewNodes.end());
@@ -95,14 +94,6 @@ class CallGraphSCC {
bool isSingular() const { return Nodes.size() == 1; }
unsigned size() const { return Nodes.size(); }
- /// ReplaceNode - This informs the SCC and the pass manager that the specified
- /// Old node has been deleted, and New is to be used in its place.
- LLVM_ABI void ReplaceNode(CallGraphNode *Old, CallGraphNode *New);
-
- /// DeleteNode - This informs the SCC and the pass manager that the specified
- /// Old node has been deleted.
- LLVM_ABI void DeleteNode(CallGraphNode *Old);
-
using iterator = std::vector<CallGraphNode *>::const_iterator;
iterator begin() const { return Nodes.begin(); }
diff --git a/llvm/lib/Analysis/CallGraphSCCPass.cpp b/llvm/lib/Analysis/CallGraphSCCPass.cpp
index b27a7c5e388c2..41e33ef2300ac 100644
--- a/llvm/lib/Analysis/CallGraphSCCPass.cpp
+++ b/llvm/lib/Analysis/CallGraphSCCPass.cpp
@@ -503,7 +503,7 @@ bool CGPassManager::runOnModule(Module &M) {
// Walk the callgraph in bottom-up SCC order.
scc_iterator<CallGraph*> CGI = scc_begin(&CG);
- CallGraphSCC CurSCC(CG, &CGI);
+ CallGraphSCC CurSCC(CG);
while (!CGI.isAtEnd()) {
// Copy the current SCC and increment past it so that the pass can hack
// on the SCC if it wants to without invalidating our iterator.
@@ -574,34 +574,6 @@ bool CGPassManager::doFinalization(CallGraph &CG) {
return Changed;
}
-//===----------------------------------------------------------------------===//
-// CallGraphSCC Implementation
-//===----------------------------------------------------------------------===//
-
-/// This informs the SCC and the pass manager that the specified
-/// Old node has been deleted, and New is to be used in its place.
-void CallGraphSCC::ReplaceNode(CallGraphNode *Old, CallGraphNode *New) {
- assert(Old != New && "Should not replace node with self");
- for (unsigned i = 0; ; ++i) {
- assert(i != Nodes.size() && "Node not in SCC");
- if (Nodes[i] != Old) continue;
- if (New)
- Nodes[i] = New;
- else
- Nodes.erase(Nodes.begin() + i);
- break;
- }
-
- // Update the active scc_iterator so that it doesn't contain dangling
- // pointers to the old CallGraphNode.
- scc_iterator<CallGraph*> *CGI = (scc_iterator<CallGraph*>*)Context;
- CGI->ReplaceNode(Old, New);
-}
-
-void CallGraphSCC::DeleteNode(CallGraphNode *Old) {
- ReplaceNode(Old, /*New=*/nullptr);
-}
-
//===----------------------------------------------------------------------===//
// CallGraphSCCPass Implementation
//===----------------------------------------------------------------------===//
More information about the llvm-commits
mailing list