[lld] r253397 - COFF: Destroy LTOModules as they are linked.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 17 15:31:00 PST 2015


Author: pcc
Date: Tue Nov 17 17:30:59 2015
New Revision: 253397

URL: http://llvm.org/viewvc/llvm-project?rev=253397&view=rev
Log:
COFF: Destroy LTOModules as they are linked.

This should help reduce memory consumption during LTO.

Differential Revision: http://reviews.llvm.org/D14672

Modified:
    lld/trunk/COFF/InputFiles.h
    lld/trunk/COFF/SymbolTable.cpp

Modified: lld/trunk/COFF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.h?rev=253397&r1=253396&r2=253397&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.h (original)
+++ lld/trunk/COFF/InputFiles.h Tue Nov 17 17:30:59 2015
@@ -205,7 +205,6 @@ public:
   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:

Modified: lld/trunk/COFF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.cpp?rev=253397&r1=253396&r2=253397&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.cpp (original)
+++ lld/trunk/COFF/SymbolTable.cpp Tue Nov 17 17:30:59 2015
@@ -406,7 +406,7 @@ std::vector<ObjectFile *> SymbolTable::c
 
   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




More information about the llvm-commits mailing list