diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2016-04-13 05:25:16 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-04-13 05:25:16 +0000 |
commit | 59269a874f23334529e17df27f35f7e38f282a71 (patch) | |
tree | 58fb0f83f952aa9132d30475c3bc4113257c3be8 /llvm/lib/Transforms/IPO/Internalize.cpp | |
parent | 3949b9e6dd1bfc7f6f83b281afa2a49fa91a61b8 (diff) | |
download | bcm5719-llvm-59269a874f23334529e17df27f35f7e38f282a71.tar.gz bcm5719-llvm-59269a874f23334529e17df27f35f7e38f282a71.zip |
Really return whether Internalize did change the Module or not.
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266169
Diffstat (limited to 'llvm/lib/Transforms/IPO/Internalize.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/Internalize.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/IPO/Internalize.cpp b/llvm/lib/Transforms/IPO/Internalize.cpp index f438b4ba434..7765cd5bf82 100644 --- a/llvm/lib/Transforms/IPO/Internalize.cpp +++ b/llvm/lib/Transforms/IPO/Internalize.cpp @@ -213,6 +213,7 @@ void Internalizer::checkComdatVisibility( } bool Internalizer::internalizeModule(Module &M, CallGraph *CG) { + bool Changed = false; CallGraphNode *ExternalNode = CG ? CG->getExternalCallingNode() : nullptr; SmallPtrSet<GlobalValue *, 8> Used; @@ -246,6 +247,7 @@ bool Internalizer::internalizeModule(Module &M, CallGraph *CG) { for (Function &I : M) { if (!maybeInternalize(I, ExternalComdats)) continue; + Changed = true; if (ExternalNode) // Remove a callgraph edge from the external node to this function. @@ -278,6 +280,7 @@ bool Internalizer::internalizeModule(Module &M, CallGraph *CG) { for (auto &GV : M.globals()) { if (!maybeInternalize(GV, ExternalComdats)) continue; + Changed = true; ++NumGlobals; DEBUG(dbgs() << "Internalized gvar " << GV.getName() << "\n"); @@ -287,18 +290,13 @@ bool Internalizer::internalizeModule(Module &M, CallGraph *CG) { for (auto &GA : M.aliases()) { if (!maybeInternalize(GA, ExternalComdats)) continue; + Changed = true; ++NumAliases; DEBUG(dbgs() << "Internalized alias " << GA.getName() << "\n"); } - // We do not keep track of whether this pass changed the module because - // it adds unnecessary complexity: - // 1) This pass will generally be near the start of the pass pipeline, so - // there will be no analyses to invalidate. - // 2) This pass will most likely end up changing the module and it isn't worth - // worrying about optimizing the case where the module is unchanged. - return true; + return Changed; } /// Public API below |