[PATCH] D57849: llvm-dwarfdump: Stop counting out-of-line subprogram in the "inlined functions" statistic.
Caroline Tice via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 7 09:08:55 PST 2019
cmtice updated this revision to Diff 185788.
cmtice added a comment.
aprantl@, you were right, my original change was not correctly updating the variable counts to include variables occuring in inlined instances of functions. I have update the patch to fix this issue. There were two additional changes needed: one to make sure we were counting variables for functions that had no inlined instances at all; and one to avoid double-counting member constants.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57849/new/
https://reviews.llvm.org/D57849
Files:
test/tools/llvm-dwarfdump/X86/stats-inlining-multi-cu.ll
test/tools/llvm-dwarfdump/X86/stats-inlining-single-cu.ll
tools/llvm-dwarfdump/Statistics.cpp
Index: tools/llvm-dwarfdump/Statistics.cpp
===================================================================
--- tools/llvm-dwarfdump/Statistics.cpp
+++ tools/llvm-dwarfdump/Statistics.cpp
@@ -175,7 +175,8 @@
return;
// We've seen an (inlined) instance of this function.
auto &FnStats = FnStatMap[Name];
- FnStats.NumFnInlined++;
+ if (IsInlinedFunction)
+ FnStats.NumFnInlined++;
FnStats.IsFunction = true;
}
@@ -266,10 +267,10 @@
unsigned NumInlinedFunctions = 0;
for (auto &Entry : Statistics) {
PerFunctionStats &Stats = Entry.getValue();
- unsigned TotalVars = Stats.VarsInFunction.size() * Stats.NumFnInlined;
+ unsigned TotalVars = Stats.VarsInFunction.size() * (Stats.NumFnInlined + 1);
unsigned Constants = Stats.ConstantMembers;
VarWithLoc += Stats.TotalVarWithLoc + Constants;
- VarTotal += TotalVars + Constants;
+ VarTotal += TotalVars;
VarUnique += Stats.VarsInFunction.size();
LLVM_DEBUG(for (auto &V : Stats.VarsInFunction) llvm::dbgs()
<< Entry.getKey() << ": " << V.getKey() << "\n");
Index: test/tools/llvm-dwarfdump/X86/stats-inlining-single-cu.ll
===================================================================
--- test/tools/llvm-dwarfdump/X86/stats-inlining-single-cu.ll
+++ test/tools/llvm-dwarfdump/X86/stats-inlining-single-cu.ll
@@ -5,9 +5,9 @@
; The results for both tests should be identical.
; CHECK: "source functions":4,
-; CHECK-SAME: "inlined functions":5,
+; CHECK-SAME: "inlined functions":2,
; CHECK-SAME: "unique source variables":4
-; CHECK-SAME: "source variables":6
+; CHECK-SAME: "source variables":8
; CHECK-SAME: "variables with location":6
;header.h:
Index: test/tools/llvm-dwarfdump/X86/stats-inlining-multi-cu.ll
===================================================================
--- test/tools/llvm-dwarfdump/X86/stats-inlining-multi-cu.ll
+++ test/tools/llvm-dwarfdump/X86/stats-inlining-multi-cu.ll
@@ -4,9 +4,9 @@
; Test that abstract origins in multiple CUs are uniqued.
; CHECK: "source functions":4,
-; CHECK-SAME: "inlined functions":5,
+; CHECK-SAME: "inlined functions":2,
; CHECK-SAME: "unique source variables":4
-; CHECK-SAME: "source variables":6
+; CHECK-SAME: "source variables":8
; CHECK-SAME: "variables with location":6
;header.h:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57849.185788.patch
Type: text/x-patch
Size: 2345 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190207/d7661bb0/attachment.bin>
More information about the llvm-commits
mailing list