[PATCH] D67768: [DebugInfo] Add interface for pre-calculating the size of emitted DWARF

David Stenberg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 07:48:02 PDT 2019


dstenb marked an inline comment as done.
dstenb added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h:336
+  SmallString<32> TmpBytes;
+  SmallVector<std::string, 8> TmpComments;
+  BufferByteStreamer TmpBS;
----------------
aprantl wrote:
> Since we have thousands of location list entries per file and DW_OP_entry_value is comparatively rare, should we make these heap- or tail-allocated (i.e. std::vector / unique_ptr)?
That seems better! I built a clang 8.0 binary with `-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS="-Xclang -femit-debug-entry-values`, and there only ~1.6% of DebugLocDwarfExpression objects needed to use the temporary buffer. As far as I understand we only have one DebugLocDwarfExpression object alive at a time, so the peak is not increased drastically, but it seems nasty to have to do unnecessary allocations/initializations for most of the objects. I'll dynamically allocate the data.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67768/new/

https://reviews.llvm.org/D67768





More information about the llvm-commits mailing list