Description
In #128861 (comment) I teased @nnethercote with the promise of more debug info inefficiency. One example is that the .debug_ranges section that specifies the ranges over which DWARF constructs such as functions, variables, etc are valid contains large amounts of repeated data. Rust's love of inlining and zero cost abstractions tends to produce repeated ranges.
When built with debuginfo-level = 2, tip Rust's librustc_driver.so has approximately 2.1 million entries in .debug_ranges. There are only approximately 1.1 million unique entries though. Doing the dumbest possible thing in LLVM (checking in DwarfFile::add_range to see if the new range is exactly equal to the last range, and not adding a new entry if it is) eliminates virtually all duplicated ranges (less than 1k remain) and results in a 43% reduction in the size of the .debug_ranges section, or a roughly 1.75% reduction in the size of the .so
@rustbot label A-debuginfo A-llvm I-heavy