[PATCH] D69027: [llvm-dwarfdump][Statistics] Fix calculation of OffsetToFirstDefinition
Alexey Lapshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 28 08:03:43 PDT 2019
avl added a comment.
> I have my patch based on two assumptions:
>
> We only care about lexically (or statically) scoped languages. Otherwise detecting a variable's scope is very problematic.
> In a lexically scoped language the end of a variable's scope should match the end of the enclosing lexical scope.
>
> That's why I a bit confused about why would we need to make some adjustments to the end of a range. Could you kindly clarify what did you mean?
Current solution with showing coverage for VarScope - OffsetToFirstDefinition looks like a mix of two concepts:
1. variable scope. Block where a variable is defined.
2. variable lifetime. The region from definition till last use.
I think the explicit separation of these two things would allow understanding statistics better. See the following example of current behavior.
> If the other metric is valuable, I suggest implementing it in a separate patch. But could you give an example when calculating coverage against full scope provides additional knowledge which does not follow from currently existing metrics?
suppose we have such case with incomplete debug info:
DW_TAG_lexical_block
DW_AT_ranges (0x00000000
[0x000000000000010, 0x0000000000000197))
DW_TAG_variable
DW_AT_location (0x0000018e
[0x0000000000000183, 0x0000000000000197): DW_OP_reg0 RAX)
And then will create a fix which improves debug info in such a way:
DW_TAG_lexical_block
DW_AT_ranges (0x00000000
[0x000000000000010, 0x0000000000000197))
DW_TAG_variable
DW_AT_location (0x0000018e
[0x0000000000000100, 0x0000000000000183): DW_OP_reg1 RBX)
[0x0000000000000183, 0x0000000000000197): DW_OP_reg0 RAX)
In both cases reported coverage there would be 100%.
That hides original low coverage for that variable and makes invisible performed improvement.
Change in coverage looks like this: 100%->100%. If it instead would be 20%->30% then result of changes would be seen.
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