[PATCH] D23836: [ThinLTO/gold] Add caching support to gold-plugin

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 10:48:18 PDT 2016


tejohnson added inline comments.

================
Comment at: llvm/trunk/tools/gold/gold-plugin.cpp:812
@@ -801,1 +811,3 @@
+          *LTOOutput(OutputName).getStream() << Buffer->getBuffer();
+        });
   };
----------------
mehdi_amini wrote:
> mehdi_amini wrote:
> > I just noticed: this is largely suboptimal, the Buffer will be a mmap'd file in memory, and you're duplicating it here.
> I didn't notice earlier because the libLTO interface returns a pointer to the memory to the linker, so the MemoryBuffer is untouched till the linker needs it (it does not need to be paged in memory, which can contributes to explains why you have much more memory pressure)
> I just noticed: this is largely suboptimal, the Buffer will be a mmap'd file in memory, and you're duplicating it here.

Dumb question - where is the duplication happening? getBuffer will give back a StringRef to the memory pointed to by the MemoryBuffer. And we then stream it to an output file (which we would have done earlier without caching).


Repository:
  rL LLVM

https://reviews.llvm.org/D23836





More information about the llvm-commits mailing list