[llvm-dwarfdump][Statistics] Unify coverage statistic computation
Summary:
The patch removes OffsetToFirstDefinition in the 'scope bytes total'
statistic computation. Thus it unifies the way the scope and the coverage
buckets are computed. The rationals behind that are the following:
1. OffsetToFirstDefinition was used to calculate the variable's life range.
However, there is no simple way to do it accurately, so the scope calculated
this way might be misleading. See D69027 for more details on the subject.
2. Both 'scope bytes total' and coverage buckets seem to be intended
to represent the same data in different ways. Otherwise, the statistics
might be controversial and confusing.
Note that the approach gives up a thorough evaluation of debug information
completeness (i.e. coverage buckets by themselves doesn't tell how good
the debug information is). Only changes in coverage over time make
a 'physical' sense.
Reviewers: djtodoro, aprantl, vsk, dblaikie, avl
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70548
diff --git a/llvm/utils/llvm-locstats/llvm-locstats.py b/llvm/utils/llvm-locstats/llvm-locstats.py
index 4df525e..6c8017a 100755
--- a/llvm/utils/llvm-locstats/llvm-locstats.py
+++ b/llvm/utils/llvm-locstats/llvm-locstats.py
@@ -25,12 +25,12 @@
variables_total_locstats,
variables_with_loc,
scope_bytes_covered,
- scope_bytes_from_first_def,
+ scope_bytes,
variables_coverage_map
):
pc_ranges_covered = int(ceil(scope_bytes_covered * 100.0)
- / scope_bytes_from_first_def)
+ / scope_bytes)
variables_coverage_per_map = {}
for cov_bucket in coverage_buckets():
variables_coverage_per_map[cov_bucket] = \
@@ -99,7 +99,7 @@
variables_total_locstats = None
variables_with_loc = None
variables_scope_bytes_covered = None
- variables_scope_bytes_from_first_def = None
+ variables_scope_bytes = None
variables_scope_bytes_entry_values = None
variables_coverage_map = {}
binary = results.file_name
@@ -130,7 +130,7 @@
json_parsed['total vars procesed by location statistics']
variables_scope_bytes_covered = \
json_parsed['vars scope bytes covered']
- variables_scope_bytes_from_first_def = \
+ variables_scope_bytes = \
json_parsed['vars scope bytes total']
if not results.ignore_debug_entry_values:
for cov_bucket in coverage_buckets():
@@ -152,7 +152,7 @@
json_parsed['total params procesed by location statistics']
variables_scope_bytes_covered = \
json_parsed['formal params scope bytes covered']
- variables_scope_bytes_from_first_def = \
+ variables_scope_bytes = \
json_parsed['formal params scope bytes total']
if not results.ignore_debug_entry_values:
for cov_bucket in coverage_buckets():
@@ -177,7 +177,7 @@
json_parsed['total variables procesed by location statistics']
variables_scope_bytes_covered = \
json_parsed['scope bytes covered']
- variables_scope_bytes_from_first_def = \
+ variables_scope_bytes = \
json_parsed['scope bytes total']
if not results.ignore_debug_entry_values:
for cov_bucket in coverage_buckets():
@@ -200,7 +200,7 @@
variables_total_locstats,
variables_with_loc,
variables_scope_bytes_covered,
- variables_scope_bytes_from_first_def,
+ variables_scope_bytes,
variables_coverage_map
)