[PATCH] D51651: [ThinLTO] Fix memory corruption in ThinLTOCodeGenerator when CodeGenOnly was specified

Steven Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 4 15:55:36 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL341422: [ThinLTO] Fix memory corruption in ThinLTOCodeGenerator when CodeGenOnly was… (authored by steven_wu, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D51651?vs=163933&id=163939#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51651

Files:
  llvm/trunk/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
  llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp


Index: llvm/trunk/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
===================================================================
--- llvm/trunk/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
+++ llvm/trunk/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
@@ -299,11 +299,6 @@
    */
   void optimize(Module &Module);
 
-  /**
-   * Perform ThinLTO CodeGen.
-   */
-  std::unique_ptr<MemoryBuffer> codegen(Module &Module);
-
   /**@}*/
 
 private:
Index: llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp
===================================================================
--- llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp
+++ llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -818,14 +818,6 @@
   optimizeModule(TheModule, *TMBuilder.create(), OptLevel, Freestanding);
 }
 
-/**
- * Perform ThinLTO CodeGen.
- */
-std::unique_ptr<MemoryBuffer> ThinLTOCodeGenerator::codegen(Module &TheModule) {
-  initTMBuilder(TMBuilder, Triple(TheModule.getTargetTriple()));
-  return codegenModule(TheModule, *TMBuilder.create());
-}
-
 /// Write out the generated object file, either from CacheEntryPath or from
 /// OutputBuffer, preferring hard-link when possible.
 /// Returns the path to the generated file in SavedObjectsDirectoryPath.
@@ -893,7 +885,7 @@
                                  /*IsImporting*/ false);
 
         // CodeGen
-        auto OutputBuffer = codegen(*TheModule);
+        auto OutputBuffer = codegenModule(*TheModule, *TMBuilder.create());
         if (SavedObjectsDirectoryPath.empty())
           ProducedBinaries[count] = std::move(OutputBuffer);
         else


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51651.163939.patch
Type: text/x-patch
Size: 1571 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180904/f9af875c/attachment.bin>


More information about the llvm-commits mailing list