[PATCH] D52917: Avoid unnecessary buffer allocation and memcpy for compressed sections.
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 4 17:36:50 PDT 2018
MaskRay added inline comments.
================
Comment at: lld/ELF/InputSection.cpp:144
+ size_t Size = UncompressedSize;
+ UncompressedBuf.reset(new char[Size]());
+
----------------
ruiu wrote:
> dblaikie wrote:
> > Did you intend to zero out this allocation? (the '()' after the [] will cause the array to be zero initialized, I think - which might be unnecessary if you're about to write to all the bytes anyway?)
> Ah thanks. We don't have to initialize the buffer.
How about omitting the initializer (`new char[Size]`) to save value initialization of each char (filling with zeroes)
https://reviews.llvm.org/D52917
More information about the llvm-commits
mailing list