[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.
This commit is contained in:
parent
fc7b860e5e
commit
c41c336ee0
|
@ -66,10 +66,7 @@ public:
|
|||
|
||||
/// 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 @@ public:
|
|||
/// 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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user