[llvm] c41c336 - [Internalize] Remove interaction with CallGraph

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 20 09:25:14 PDT 2023


Author: Arthur Eubanks
Date: 2023-03-20T09:24:11-07:00
New Revision: c41c336ee065a53899b8fd4fee3b4ab73370aa7e

URL: https://github.com/llvm/llvm-project/commit/c41c336ee065a53899b8fd4fee3b4ab73370aa7e
DIFF: https://github.com/llvm/llvm-project/commit/c41c336ee065a53899b8fd4fee3b4ab73370aa7e.diff

LOG: [Internalize] Remove interaction with CallGraph

Internalize was trying to update CallGraph if the analysis was available, but the new PM doesn't really use it so there's little reason to update it.

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/IPO/Internalize.h
    llvm/lib/Transforms/IPO/Internalize.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/IPO/Internalize.h b/llvm/include/llvm/Transforms/IPO/Internalize.h
index adcf5a932be01..5beb925bb089d 100644
--- a/llvm/include/llvm/Transforms/IPO/Internalize.h
+++ b/llvm/include/llvm/Transforms/IPO/Internalize.h
@@ -66,10 +66,7 @@ class InternalizePass : public PassInfoMixin<InternalizePass> {
 
   /// Run the internalizer on \p TheModule, returns true if any changes was
   /// made.
-  ///
-  /// If the CallGraph \p CG is supplied, it will be updated when
-  /// internalizing a function (by removing any edge from the "external node")
-  bool internalizeModule(Module &TheModule, CallGraph *CG = nullptr);
+  bool internalizeModule(Module &TheModule);
 
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
@@ -77,10 +74,9 @@ class InternalizePass : public PassInfoMixin<InternalizePass> {
 /// Helper function to internalize functions and variables in a Module.
 inline bool
 internalizeModule(Module &TheModule,
-                  std::function<bool(const GlobalValue &)> MustPreserveGV,
-                  CallGraph *CG = nullptr) {
+                  std::function<bool(const GlobalValue &)> MustPreserveGV) {
   return InternalizePass(std::move(MustPreserveGV))
-      .internalizeModule(TheModule, CG);
+      .internalizeModule(TheModule);
 }
 } // end namespace llvm
 

diff  --git a/llvm/lib/Transforms/IPO/Internalize.cpp b/llvm/lib/Transforms/IPO/Internalize.cpp
index 5982b8eafee81..21d649296cb0e 100644
--- a/llvm/lib/Transforms/IPO/Internalize.cpp
+++ b/llvm/lib/Transforms/IPO/Internalize.cpp
@@ -183,9 +183,8 @@ void InternalizePass::checkComdat(
     Info.External = true;
 }
 
-bool InternalizePass::internalizeModule(Module &M, CallGraph *CG) {
+bool InternalizePass::internalizeModule(Module &M) {
   bool Changed = false;
-  CallGraphNode *ExternalNode = CG ? CG->getExternalCallingNode() : nullptr;
 
   SmallVector<GlobalValue *, 4> Used;
   collectUsedGlobalVariables(M, Used, false);
@@ -242,10 +241,6 @@ bool InternalizePass::internalizeModule(Module &M, CallGraph *CG) {
       continue;
     Changed = true;
 
-    if (ExternalNode)
-      // Remove a callgraph edge from the external node to this function.
-      ExternalNode->removeOneAbstractEdgeTo((*CG)[&I]);
-
     ++NumFunctions;
     LLVM_DEBUG(dbgs() << "Internalizing func " << I.getName() << "\n");
   }
@@ -277,7 +272,7 @@ bool InternalizePass::internalizeModule(Module &M, CallGraph *CG) {
 InternalizePass::InternalizePass() : MustPreserveGV(PreserveAPIList()) {}
 
 PreservedAnalyses InternalizePass::run(Module &M, ModuleAnalysisManager &AM) {
-  if (!internalizeModule(M, AM.getCachedResult<CallGraphAnalysis>(M)))
+  if (!internalizeModule(M))
     return PreservedAnalyses::all();
 
   PreservedAnalyses PA;


        


More information about the llvm-commits mailing list