[llvm] [DWARFVerifier] Allow overlapping ranges for ICF-merged functions (PR #117952)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 09:48:25 PST 2024


dwblaikie wrote:

> > I remember looking at the DWARF spec and noticing that there's no exception for function merging.
> 
> In the current [DWARF 5 spec](https://dwarfstd.org/doc/DWARF5.pdf) I can't find anything saying that overlapping address ranges are not allowed between `DW_TAG_subprogram`'s.
> 
> The only thing I can find is on page 53, line 15 where it says:
> 
> > Bounded range entries in a range list may not overlap.
> 
> I read this as saying that if a `DW_TAG_subprogram` has `DW_AT_ranges` then the ranges of the single `DW_TAG_subprogram` cannot overlap between them.
> 
> Am I missing something - or should the proposal be a request to clarify that identical overlapping address ranges are allowed between `DW_TAG_subprogram`'s ?

If you have overlapping subranges between subprograms, then you'll probably also end up with overlapping subranges within a single CU range list (if two functions in a single CU got ICF'd), and across CUs (if two functions across CUs got ICF'd).

It seems possible for identical overlapping subranges within a subprogram too (if two basic blocks in a single function are identical/get merged - chances are an optimizer would deduplicate those, but not guaranteed/no need to include that restriction I think - probably could come up at -O0 with basic block sections (bit of a weird feature combo, but possible))

https://github.com/llvm/llvm-project/pull/117952


More information about the llvm-commits mailing list