This new pass for llvm-reduce attempts to reduce DebugInfo metadata. The strategy is as follows:
- Scan every MD node, keeping track of nodes already visited.
- Look for DebugInfo nodes, then record any operands that are lists.
- Ignore empty lists.
- Bisect though all the elements of the collected lists.
- Ignore any elements that are not references to other DebugInfo MD.
- 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 |
looks copy/pasted