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

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 19:14:46 PST 2024


================
@@ -622,7 +627,8 @@ unsigned DWARFVerifier::verifyDieRanges(const DWARFDie &Die,
   }
 
   // Verify that children don't intersect.
-  const auto IntersectingChild = ParentRI.insert(RI);
+  bool AllowDuplicates = Die.getTag() == DW_TAG_subprogram;
----------------
alx32 wrote:

> Is this only allowing duplicates on DW_AT_ranges of DW_AT_subprograms

So this is only relating to `DW_AT_subprogram`'s - allowing them to overlap like this:
- Allows `DW_AT_ranges`'s to overlap in between different `DW_AT_subprogram`'s
- Allows identical `DW_AT_low_pc` / `DW_AT_high_pc` in between `DW_AT_subprogram`'s

> doesn't cover the case where a subprogram's sections might overlap with itself
- No, if multiple `DW_AT_ranges`'s in a `DW_AT_subprogram` overlap - this will still raise an error. **Should we cover this case also ?**

> But shouldn't this apply to CUs too? 
- `llvm-dwarfdump --error-display=details --verify` does currently not raise any errors for overlapping CU's.

> But, equally, this should apply to lexical scopes too
- Same as above, `llvm-dwarfdump --error-display=details --verify` does currently not raise any errors for overlapping lexical blocks. 

I tested using [this script](https://gist.github.com/alx32/10bde9ac21879b50a96e32e8219aa746) which generates DWARF [dumped here](https://gist.github.com/alx32/48019a09210c5e59fed32f5a124307fb).
The [output with this patch](https://gist.github.com/alx32/30ace460e5b249aca7b06891d7695e4a) shows no errors. 
The [output without this patch](https://gist.github.com/alx32/63dad3129f1b1c55265fc79fe438bcea) shows the errors for overlapping `DW_AT_subprogram`'s

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


More information about the llvm-commits mailing list