diff options
Diffstat (limited to 'llvm/lib/Transforms/IPO/Internalize.cpp')
| -rw-r--r-- | llvm/lib/Transforms/IPO/Internalize.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/llvm/lib/Transforms/IPO/Internalize.cpp b/llvm/lib/Transforms/IPO/Internalize.cpp index db3b4384ce67..692e445cb7cb 100644 --- a/llvm/lib/Transforms/IPO/Internalize.cpp +++ b/llvm/lib/Transforms/IPO/Internalize.cpp @@ -201,21 +201,6 @@ bool InternalizePass::internalizeModule(Module &M, CallGraph *CG) { AlwaysPreserved.insert(V->getName()); } - // Mark all functions not in the api as internal. - IsWasm = Triple(M.getTargetTriple()).isOSBinFormatWasm(); - for (Function &I : M) { - if (!maybeInternalize(I, ComdatMap)) - 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"); - } - // Never internalize the llvm.used symbol. It is used to implement // attribute((used)). // FIXME: Shouldn't this just filter on llvm.metadata section?? @@ -237,6 +222,21 @@ bool InternalizePass::internalizeModule(Module &M, CallGraph *CG) { else AlwaysPreserved.insert("__stack_chk_guard"); + // Mark all functions not in the api as internal. + IsWasm = Triple(M.getTargetTriple()).isOSBinFormatWasm(); + for (Function &I : M) { + if (!maybeInternalize(I, ComdatMap)) + 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"); + } + // Mark all global variables with initializers that are not in the api as // internal as well. for (auto &GV : M.globals()) { |
