summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm-c/lto.h6
-rw-r--r--tools/lto/LTOCodeGenerator.cpp8
-rw-r--r--tools/lto/LTOCodeGenerator.h2
-rw-r--r--tools/lto/lto.cpp6
-rw-r--r--tools/lto/lto.exports1
5 files changed, 5 insertions, 18 deletions
diff --git a/include/llvm-c/lto.h b/include/llvm-c/lto.h
index 5d9cecbc51..f43d365e3d 100644
--- a/include/llvm-c/lto.h
+++ b/include/llvm-c/lto.h
@@ -251,12 +251,6 @@ lto_codegen_set_assembler_args(lto_code_gen_t cg, const char **args,
int nargs);
/**
- * Enables the internalize pass during LTO optimizations.
- */
-extern void
-lto_codegen_set_whole_program_optimization(lto_code_gen_t cg);
-
-/**
* Adds to a list of all global symbols that must exist in the final
* generated code. If a function is not listed, it might be
* inlined into every usage and optimized away.
diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp
index 77c06a655b..6382a3f219 100644
--- a/tools/lto/LTOCodeGenerator.cpp
+++ b/tools/lto/LTOCodeGenerator.cpp
@@ -64,7 +64,7 @@ LTOCodeGenerator::LTOCodeGenerator()
: _context(getGlobalContext()),
_linker("LinkTimeOptimizer", "ld-temp.o", _context), _target(NULL),
_emitDwarfDebugInfo(false), _scopeRestrictionsDone(false),
- _runInternalizePass(false), _codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC),
+ _codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC),
_nativeObjectFile(NULL) {
InitializeAllTargets();
InitializeAllTargetMCs();
@@ -355,8 +355,10 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
// Add an appropriate TargetData instance for this module...
passes.add(new TargetData(*_target->getTargetData()));
- PassManagerBuilder().populateLTOPassManager(passes,
- _runInternalizePass,
+ // Enabling internalize here would use its AllButMain variant. It
+ // keeps only main if it exists and does nothing for libraries. Instead
+ // we create the pass ourselves with the symbol list provided by the linker.
+ PassManagerBuilder().populateLTOPassManager(passes, /*Internalize=*/false,
!DisableInline,
DisableGVNLoadPRE);
diff --git a/tools/lto/LTOCodeGenerator.h b/tools/lto/LTOCodeGenerator.h
index bac3e6efe9..032dc37917 100644
--- a/tools/lto/LTOCodeGenerator.h
+++ b/tools/lto/LTOCodeGenerator.h
@@ -54,8 +54,6 @@ struct LTOCodeGenerator {
const void *compile(size_t *length, std::string &errMsg);
void setCodeGenDebugOptions(const char *opts);
- void enableInternalizePass() { _runInternalizePass = true; }
-
private:
bool generateObjectFile(llvm::raw_ostream &out, std::string &errMsg);
void applyScopeRestrictions();
diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp
index addf7877c9..a7e633d14b 100644
--- a/tools/lto/lto.cpp
+++ b/tools/lto/lto.cpp
@@ -183,12 +183,6 @@ void lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg,
cg->addMustPreserveSymbol(symbol);
}
-/// lto_codegen_set_whole_program_optimization - Enable the internalize pass
-/// during LTO optimizations.
-void lto_codegen_set_whole_program_optimization(lto_code_gen_t cg) {
- cg->enableInternalizePass();
-}
-
/// lto_codegen_write_merged_modules - Writes a new file at the specified path
/// that contains the merged contents of all modules added so far. Returns true
/// on error (check lto_get_error_message() for details).
diff --git a/tools/lto/lto.exports b/tools/lto/lto.exports
index f471f1ad6a..b900bfb594 100644
--- a/tools/lto/lto.exports
+++ b/tools/lto/lto.exports
@@ -27,7 +27,6 @@ lto_codegen_set_assembler_args
lto_codegen_set_assembler_path
lto_codegen_set_cpu
lto_codegen_compile_to_file
-lto_codegen_set_whole_program_optimization
LLVMCreateDisasm
LLVMDisasmDispose
LLVMDisasmInstruction