[PATCH] D52917: Avoid unnecessary buffer allocation and memcpy for compressed sections.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 4 17:56:24 PDT 2018


ruiu added inline comments.


================
Comment at: lld/ELF/InputSection.cpp:155
+  if (UncompressedSize >= 0 && !UncompressedBuf)
+    const_cast<InputSectionBase *>(this)->uncompress();
+  return RawData;
----------------
MaskRay wrote:
> It seems `uncompress()` is only called once. What do you think if `uncompress()` is inlined here and these mutable member variables are marked as `mutable`?
> 
I could, but I'm not sure if it is a good thing to mark `RawData` and `UncompressedBuf` mutable throughout this class. At least in this way, only this function mutates these members.


https://reviews.llvm.org/D52917





More information about the llvm-commits mailing list