[PATCH] D73002: [llvm-dwarfdump][Statistics] Count more than one conrete out-of-line instances of a function
Kristina Bessonova via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 19 08:03:55 PST 2020
krisb created this revision.
krisb added reviewers: djtodoro, aprantl.
krisb added a project: debug-info.
Herald added a reviewer: jhenderson.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
krisb added a parent revision: D72797: [llvm-dwarfdump][Statistics] Distinguish functions/variables with same name across different CUs.
Here may be more than one out-of-line instance of the same function among different CUs. All of them should be accounted for to get an accurate total number of variables/parameters.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D73002
Files:
llvm/tools/llvm-dwarfdump/Statistics.cpp
Index: llvm/tools/llvm-dwarfdump/Statistics.cpp
===================================================================
--- llvm/tools/llvm-dwarfdump/Statistics.cpp
+++ llvm/tools/llvm-dwarfdump/Statistics.cpp
@@ -22,6 +22,8 @@
struct PerFunctionStats {
/// Number of inlined instances of this function.
unsigned NumFnInlined = 0;
+ /// Number of out-of-line instances of this function.
+ unsigned NumFnOutOfLine = 0;
/// Number of inlined instances that have abstract origins.
unsigned NumAbstractOrigins = 0;
/// Number of variables and parameters with location across all inlined
@@ -33,9 +35,6 @@
StringSet<> VarsInFunction;
/// Compile units also cover a PC range, but have this flag set to false.
bool IsFunction = false;
- /// Verify function definition has PC addresses (for detecting when
- /// a function has been inlined everywhere).
- bool HasPCAddresses = false;
/// Function has source location information.
bool HasSourceLocation = false;
/// Number of function parameters.
@@ -403,17 +402,17 @@
if (Die.find(dwarf::DW_AT_inline))
return;
std::string FnID = constructDieID(Die);
- // We've seen an (inlined) instance of this function.
+ // We've seen an instance of this function.
auto &FnStats = FnStatMap[FnID];
FnStats.IsFunction = true;
if (IsInlinedFunction) {
FnStats.NumFnInlined++;
if (Die.findRecursively(dwarf::DW_AT_abstract_origin))
FnStats.NumAbstractOrigins++;
+ } else {
+ FnStats.NumFnOutOfLine++;
}
FnStats.IsFunction = true;
- if (BytesInThisScope && !IsInlinedFunction)
- FnStats.HasPCAddresses = true;
if (Die.findRecursively(dwarf::DW_AT_decl_file) &&
Die.findRecursively(dwarf::DW_AT_decl_line))
FnStats.HasSourceLocation = true;
@@ -526,9 +525,10 @@
unsigned VarWithLoc = 0;
for (auto &Entry : Statistics) {
PerFunctionStats &Stats = Entry.getValue();
- unsigned TotalVars = Stats.VarsInFunction.size() * Stats.NumFnInlined;
- // Count variables in concrete out-of-line functions and in global scope.
- if (Stats.HasPCAddresses || !Stats.IsFunction)
+ unsigned TotalVars = Stats.VarsInFunction.size() *
+ (Stats.NumFnInlined + Stats.NumFnOutOfLine);
+ // Count variables in global scope.
+ if (!Stats.IsFunction)
TotalVars += Stats.VarsInFunction.size();
unsigned Constants = Stats.ConstantMembers;
VarParamWithLoc += Stats.TotalVarWithLoc + Constants;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73002.238993.patch
Type: text/x-patch
Size: 2544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200119/08fbe439/attachment.bin>
More information about the llvm-commits
mailing list