[PATCH] D132077: [llvm-reduce] Add pass that reduces DebugInfo metadata

Matthew Voss via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 17 15:15:10 PDT 2022


ormris created this revision.
ormris added reviewers: arsenm, aeubanks.
Herald added a subscriber: mgorny.
Herald added a project: All.
ormris requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

This new pass for llvm-reduce attempts to reduce DebugInfo metadata. The strategy is as follows:

1. Scan every MD node, keeping track of nodes already visited.
2. Look for DebugInfo nodes, then record any operands that are lists.
  - Ignore empty lists.
3. Bisect though all the elements of the collected lists.
  - Ignore any elements that are not references to other DebugInfo MD.
4. If all elements of the list are null, replace with an empty list.

This process can dramatically simplify the module. Without going into exactly what is removed, the difference in the final file size show how large the difference is. This uses a large internal bitcode test case.

| Reduction strategy | Size |
| No reduction       | 22M  |
| Current            | 49K  |
| With Patch         | 5.6K |
|

I've taken more measurements of the runtime impact and it's not too bad. It's negligible when only 1 thread is used, but increases with multiple threads.

| Threads: | Current (s) | With Patch (s) |
| -j 1     | 203.33      | 203.67         |
| -j 8     | 201.33      | 203.33         |
|


https://reviews.llvm.org/D132077

Files:
  llvm/test/tools/llvm-reduce/Inputs/remove-dimetadata.py
  llvm/test/tools/llvm-reduce/remove-dimetadata.ll
  llvm/tools/llvm-reduce/CMakeLists.txt
  llvm/tools/llvm-reduce/DeltaManager.cpp
  llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp
  llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132077.453431.patch
Type: text/x-patch
Size: 9014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220817/e009fb47/attachment.bin>


More information about the llvm-commits mailing list