Change the internalize pass to internalize all symbols when given an empty

list of externals. This makes sense since a shared library with no symbols
can still be useful if it has static constructors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166795 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2012-10-26 18:47:48 +00:00
parent 276c43f022
commit e5551ed9ce
8 changed files with 41 additions and 50 deletions

View File

@@ -245,8 +245,11 @@ void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM,
// Now that composite has been compiled, scan through the module, looking
// for a main function. If main is defined, mark all other functions
// internal.
if (Internalize)
PM.add(createInternalizePass(true));
if (Internalize) {
std::vector<const char*> E;
E.push_back("main");
PM.add(createInternalizePass(E));
}
// Propagate constants at call sites into the functions they call. This
// opens opportunities for globalopt (and inlining) by substituting function