[PATCH] D156773: Increase performance of llvm-gsymutil by up to 200%.

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 31 22:32:55 PDT 2023


clayborg created this revision.
clayborg added reviewers: aprantl, yinghuitan, ayermolo.
Herald added subscribers: mgrang, hiraditya.
Herald added a project: All.
clayborg requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

llvm-gsymutil was maintaining an address ranges collection behind a mutex and having the multi-threaded code access this and hold the mutex was causing slowdown when converting DWARF to GSYM. This patch does the following:

- removes the "Ranges" variable from the GsymCreator and any functions and places that used it
- clients don't try to detect if a function has been added for an address range, we now remove any inferior copies of information in the GsymCreator::finalize() routine as was done before, we just have more items to remove, though performance is greator due to less mutex thread locking
- after I started adding all of the inferior funtion info objects the previous patch that tried to remove infrior debug info had bugs in it, so I replace the removeIfBinary() function in GsymCreator with a more efficient and easier to debug way to do things which copies items from the GsymCreator::Funcs into a new vector of FunctionInfo objects and then replaces GsymCreator::Funcs at the end.
- Sorting of FunctionInfo objects has been modified to also compare InlineInfo objects. We found cases where LTO was ruining inline function address ranges and we ended up with a variety of FunctionInfo objects for the same range that had varying amounts of valid debug info. This patch now ensure that two function info objects with different inline info for the same function address range, the best one will be picked to ensure the greatest fidelity.
- If we detect that a DW_TAG_subprogram has inline functions and after parsing it, we don't end up with any valid inline information, we set the optional to std::nullopt to avoid emitting empty inline information and wasting space.

My tests show a 200% perf increase on M1 <https://reviews.llvm.org/M1> macs and a 100% performance increase on linux machines for the same complex large DWARF input binary.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156773

Files:
  llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h
  llvm/include/llvm/DebugInfo/GSYM/GsymCreator.h
  llvm/include/llvm/DebugInfo/GSYM/InlineInfo.h
  llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
  llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
  llvm/lib/DebugInfo/GSYM/InlineInfo.cpp
  llvm/lib/DebugInfo/GSYM/ObjectFileTransformer.cpp
  llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
  llvm/test/tools/llvm-gsymutil/X86/elf-dwarf.yaml
  llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
  llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156773.545916.patch
Type: text/x-patch
Size: 49055 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230801/e525acc0/attachment.bin>


More information about the llvm-commits mailing list