summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-dwarfdump
diff options
context:
space:
mode:
authorKristina Bessonova <kbessonova@accesssoftek.com>2019-12-05 16:45:57 +0300
committerKristina Bessonova <kbessonova@accesssoftek.com>2019-12-13 17:34:58 +0300
commitd5655c4d2e180b7eadb567ebf7e9a9393dec1355 (patch)
treecdb86002e7dc20b7dd8eae1a370b4ba8661d7fb7 /llvm/tools/llvm-dwarfdump
parent97572775d2fe088d8059b3a9423f6d8539fafe33 (diff)
downloadbcm5719-llvm-d5655c4d2e180b7eadb567ebf7e9a9393dec1355.tar.gz
bcm5719-llvm-d5655c4d2e180b7eadb567ebf7e9a9393dec1355.zip
[llvm-dwarfdump][Statistics] Don't count coverage less than 1% as 0%
Summary: This is a follow up for D70548. Currently, variables with debug info coverage between 0% and 1% are put into zero-bucket. D70548 changed the way statistics calculate a variable's coverage: we began to use enclosing scope rather than a possible variable life range. Thus more variables might be moved to zero-bucket despite they have some debug info coverage. The patch is to distinguish between a variable that has location info but it's significantly less than its enclosing scope and a variable that doesn't have it at all. Reviewers: djtodoro, aprantl, dblaikie, avl Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71070
Diffstat (limited to 'llvm/tools/llvm-dwarfdump')
-rw-r--r--llvm/tools/llvm-dwarfdump/Statistics.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/llvm/tools/llvm-dwarfdump/Statistics.cpp b/llvm/tools/llvm-dwarfdump/Statistics.cpp
index 2d0f30476e3..5bef4d5148c 100644
--- a/llvm/tools/llvm-dwarfdump/Statistics.cpp
+++ b/llvm/tools/llvm-dwarfdump/Statistics.cpp
@@ -138,18 +138,16 @@ static void collectLocStats(uint64_t BytesCovered, uint64_t BytesInScope,
std::vector<unsigned> &VarLocStats, bool IsParam,
bool IsLocalVar) {
auto getCoverageBucket = [BytesCovered, BytesInScope]() -> unsigned {
- unsigned LocBucket = 100 * (double)BytesCovered / BytesInScope;
- if (LocBucket == 0) {
- // No debug location at all for the variable.
+ // No debug location at all for the variable.
+ if (BytesCovered == 0)
return 0;
- } else if (LocBucket == 100 || BytesCovered > BytesInScope) {
- // Fully covered variable within its scope.
+ // Fully covered variable within its scope.
+ if (BytesCovered >= BytesInScope)
return NumOfCoverageCategories - 1;
- } else {
- // Get covered range (e.g. 20%-29%).
- LocBucket /= 10;
- return LocBucket + 1;
- }
+ // Get covered range (e.g. 20%-29%).
+ unsigned LocBucket = 100 * (double)BytesCovered / BytesInScope;
+ LocBucket /= 10;
+ return LocBucket + 1;
};
unsigned CoverageBucket = getCoverageBucket();
@@ -430,9 +428,9 @@ static void printLocationStats(raw_ostream &OS,
<< LocationStats[0];
LLVM_DEBUG(llvm::dbgs() << Key << " with 0% of its scope covered: "
<< LocationStats[0] << '\n');
- OS << ",\"" << Key << " with [1%,10%) of its scope covered\":"
+ OS << ",\"" << Key << " with (0%,10%) of its scope covered\":"
<< LocationStats[1];
- LLVM_DEBUG(llvm::dbgs() << Key << " with [1%,10%) of its scope covered: "
+ LLVM_DEBUG(llvm::dbgs() << Key << " with (0%,10%) of its scope covered: "
<< LocationStats[1] << '\n');
for (unsigned i = 2; i < NumOfCoverageCategories - 1; ++i) {
OS << ",\"" << Key << " with [" << (i - 1) * 10 << "%," << i * 10
OpenPOWER on IntegriCloud