[PATCH] D14672: COFF: Destroy LTOModules as they are linked.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 13 18:18:51 PST 2015


pcc created this revision.
pcc added a reviewer: ruiu.
pcc added a subscriber: llvm-commits.
Herald added a subscriber: joker.eph.

This should help reduce memory consumption during LTO. Also works around a
bug [1] in the module linker.

[1] http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312869.html

http://reviews.llvm.org/D14672

Files:
  COFF/InputFiles.h
  COFF/SymbolTable.cpp

Index: COFF/SymbolTable.cpp
===================================================================
--- COFF/SymbolTable.cpp
+++ COFF/SymbolTable.cpp
@@ -406,7 +406,7 @@
 
   CG->setModule(BitcodeFiles[0]->takeModule());
   for (unsigned I = 1, E = BitcodeFiles.size(); I != E; ++I)
-    CG->addModule(BitcodeFiles[I]->getModule());
+    CG->addModule(BitcodeFiles[I]->takeModule().get());
 
   bool DisableVerify = true;
 #ifdef NDEBUG
Index: COFF/InputFiles.h
===================================================================
--- COFF/InputFiles.h
+++ COFF/InputFiles.h
@@ -205,7 +205,6 @@
   std::vector<SymbolBody *> &getSymbols() override { return SymbolBodies; }
   MachineTypes getMachineType() override;
 
-  LTOModule *getModule() const { return M.get(); }
   std::unique_ptr<LTOModule> takeModule() { return std::move(M); }
 
 private:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14672.40195.patch
Type: text/x-patch
Size: 844 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151114/ed9fac66/attachment.bin>


More information about the llvm-commits mailing list