From 70507e59fe06e187045ad1c6abd518495683f038 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Tue, 17 Nov 2015 23:30:59 +0000 Subject: [PATCH] COFF: Destroy LTOModules as they are linked. This should help reduce memory consumption during LTO. Differential Revision: http://reviews.llvm.org/D14672 llvm-svn: 253397 --- lld/COFF/InputFiles.h | 1 - lld/COFF/SymbolTable.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lld/COFF/InputFiles.h b/lld/COFF/InputFiles.h index ca9ed3f5ddb4..6a263fbaddf6 100644 --- a/lld/COFF/InputFiles.h +++ b/lld/COFF/InputFiles.h @@ -205,7 +205,6 @@ public: std::vector &getSymbols() override { return SymbolBodies; } MachineTypes getMachineType() override; - LTOModule *getModule() const { return M.get(); } std::unique_ptr takeModule() { return std::move(M); } private: diff --git a/lld/COFF/SymbolTable.cpp b/lld/COFF/SymbolTable.cpp index e9f08f0bf5e8..802d354d5d97 100644 --- a/lld/COFF/SymbolTable.cpp +++ b/lld/COFF/SymbolTable.cpp @@ -406,7 +406,7 @@ std::vector SymbolTable::createLTOObjects(LTOCodeGenerator *CG) { 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