[llvm-commits] [llvm] r154807 - in /llvm/trunk: include/llvm-c/lto.h tools/lto/LTOCodeGenerator.cpp tools/lto/LTOCodeGenerator.h tools/lto/lto.cpp tools/lto/lto.exports

Rafael Espindola rafael.espindola at gmail.com
Mon Apr 16 03:58:39 PDT 2012


Author: rafael
Date: Mon Apr 16 05:58:38 2012
New Revision: 154807

URL: http://llvm.org/viewvc/llvm-project?rev=154807&view=rev
Log:
Remove lto_codegen_set_whole_program_optimization. It is a work in progress,
so we don't want it to show up in the stable 3.1 interface.

While at it, add a comment about why LTOCodeGenerator manually creates the
internalize pass.

Modified:
    llvm/trunk/include/llvm-c/lto.h
    llvm/trunk/tools/lto/LTOCodeGenerator.cpp
    llvm/trunk/tools/lto/LTOCodeGenerator.h
    llvm/trunk/tools/lto/lto.cpp
    llvm/trunk/tools/lto/lto.exports

Modified: llvm/trunk/include/llvm-c/lto.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/lto.h?rev=154807&r1=154806&r2=154807&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/lto.h (original)
+++ llvm/trunk/include/llvm-c/lto.h Mon Apr 16 05:58:38 2012
@@ -251,12 +251,6 @@
                                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.

Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=154807&r1=154806&r2=154807&view=diff
==============================================================================
--- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Mon Apr 16 05:58:38 2012
@@ -64,7 +64,7 @@
   : _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 @@
   // 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);
 

Modified: llvm/trunk/tools/lto/LTOCodeGenerator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.h?rev=154807&r1=154806&r2=154807&view=diff
==============================================================================
--- llvm/trunk/tools/lto/LTOCodeGenerator.h (original)
+++ llvm/trunk/tools/lto/LTOCodeGenerator.h Mon Apr 16 05:58:38 2012
@@ -54,8 +54,6 @@
   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();

Modified: llvm/trunk/tools/lto/lto.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=154807&r1=154806&r2=154807&view=diff
==============================================================================
--- llvm/trunk/tools/lto/lto.cpp (original)
+++ llvm/trunk/tools/lto/lto.cpp Mon Apr 16 05:58:38 2012
@@ -183,12 +183,6 @@
   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).

Modified: llvm/trunk/tools/lto/lto.exports
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.exports?rev=154807&r1=154806&r2=154807&view=diff
==============================================================================
--- llvm/trunk/tools/lto/lto.exports (original)
+++ llvm/trunk/tools/lto/lto.exports Mon Apr 16 05:58:38 2012
@@ -27,7 +27,6 @@
 lto_codegen_set_assembler_path
 lto_codegen_set_cpu
 lto_codegen_compile_to_file
-lto_codegen_set_whole_program_optimization
 LLVMCreateDisasm
 LLVMDisasmDispose
 LLVMDisasmInstruction





More information about the llvm-commits mailing list