[PATCH] D69027: [llvm-dwarfdump][Statistics] Fix calculation of OffsetToFirstDefinition

Kristina Bessonova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 9 11:57:05 PST 2019


krisb added a comment.

When I started to work on the statistics, I also thought that the percentage buckets are to show completeness of the debug info. Unfortunately, due to BB reordering this information, sometimes not just imprecise, but rather terribly wrong. And in general case, we can't even guarantee any precision. I agree with @dblaikie; we need a way to calculate adjusted scope correctly regardless of basic block reordering to justify the notion of the adjusted scope itself. Otherwise, I'd prefer to reduce maintenance costs and to calculate debug info coverage against the full enclosing scope. In such a case, only changes in percentages would make sense, but at least this information won't be misleading. So, I tend to abandon this patch and proceed with another one that changes all the calculations against an adjusted scope to calculations against a full enclosing scope (if there are no strong objections).

There is another thought about the adjusted scope, though. It's clearly out of the scope of this patch, but it's probably worth to discuss it here. I just found that the dwarf specification (both v4 and v5) provides the `DW_AT_start_scope` attribute, which represents exactly the 'adjusted' scope. So, as a possible solution we can move all the calculations of the adjusted scope to the compiler (but I have no idea if the compiler can emit something precise enough here and it's worth to do for statistic's purpose). The usage of the attribute was discussed in the context of the `dwarflint --stats` tool, but it was more than nine years ago: https://lists.fedorahosted.org/pipermail/elfutils-devel/2010-July/001498.html. As I can see, neither gcc nor clang produces this attribute at the moment.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69027/new/

https://reviews.llvm.org/D69027





More information about the llvm-commits mailing list