[PATCH] D101025: [llvm-dwarfdump] Fix inline function stats calculation
Djordje Todorovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 22 00:18:38 PDT 2021
djtodoro created this revision.
djtodoro added reviewers: aprantl, dblaikie.
djtodoro added a project: debug-info.
Herald added a reviewer: jhenderson.
Herald added a subscriber: cmtice.
djtodoro requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.
There are cases where a concrete DIE with `DW_TAG_subprogram` can have `abstract_origin` attribute, so we handle that situation as well.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D101025
Files:
llvm/test/tools/llvm-dwarfdump/X86/statistics-dwo.test
llvm/test/tools/llvm-dwarfdump/X86/statistics-v3.test
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
@@ -462,9 +462,15 @@
return;
// Handle any kind of lexical scope.
- const bool IsFunction = Tag == dwarf::DW_TAG_subprogram;
+ const bool HasAbstractOriginAttr =
+ Die.find(dwarf::DW_AT_abstract_origin) != None;
+ const bool IsFunction =
+ ((Tag == dwarf::DW_TAG_subprogram) && !HasAbstractOriginAttr);
const bool IsBlock = Tag == dwarf::DW_TAG_lexical_block;
- const bool IsInlinedFunction = Tag == dwarf::DW_TAG_inlined_subroutine;
+ const bool IsInlinedFunction =
+ (Tag == dwarf::DW_TAG_inlined_subroutine ||
+ (Tag == dwarf::DW_TAG_subprogram && HasAbstractOriginAttr));
+
InlinedVarsTy InlinedVars;
// Get the vars of the inlined fn, so the locstats
// reports the missing vars (with coverage 0%).
Index: llvm/test/tools/llvm-dwarfdump/X86/statistics-v3.test
===================================================================
--- llvm/test/tools/llvm-dwarfdump/X86/statistics-v3.test
+++ llvm/test/tools/llvm-dwarfdump/X86/statistics-v3.test
@@ -67,8 +67,8 @@
CHECK: "version": 7,
CHECK: "#functions": 3,
CHECK: "#functions with location": 3,
-CHECK: "#inlined functions": 8,
-CHECK: "#inlined functions with abstract origins": 8,
+CHECK: "#inlined functions": 9,
+CHECK: "#inlined functions with abstract origins": 9,
CHECK: "#unique source variables": 9,
CHECK: "#source variables": 33,
@@ -77,8 +77,8 @@
CHECK: "#call site entries": 8,
CHECK: "sum_all_variables(#bytes in parent scope)": 3072,
CHECK: "sum_all_variables(#bytes in parent scope covered by DW_AT_location)": 1188,
-CHECK: "#bytes within functions": 636,
-CHECK: "#bytes within inlined functions": 388,
+CHECK: "#bytes within functions": 566,
+CHECK: "#bytes within inlined functions": 458,
CHECK: "#params": 13,
CHECK-NEXT: "#params with source location": 13,
CHECK-NEXT: "#params with type": 13,
Index: llvm/test/tools/llvm-dwarfdump/X86/statistics-dwo.test
===================================================================
--- llvm/test/tools/llvm-dwarfdump/X86/statistics-dwo.test
+++ llvm/test/tools/llvm-dwarfdump/X86/statistics-dwo.test
@@ -72,8 +72,8 @@
CHECK: "version": 7,
CHECK: "#functions": 3,
CHECK: "#functions with location": 3,
-CHECK: "#inlined functions": 7,
-CHECK: "#inlined functions with abstract origins": 7,
+CHECK: "#inlined functions": 8,
+CHECK: "#inlined functions with abstract origins": 8,
CHECK: "#unique source variables": 9,
CHECK: "#source variables": 30,
@@ -82,8 +82,8 @@
CHECK: "#call site entries": 7,
CHECK: "sum_all_variables(#bytes in parent scope)": 2817,
CHECK: "sum_all_variables(#bytes in parent scope covered by DW_AT_location)": 1160,
-CHECK: "#bytes within functions": 594,
-CHECK: "#bytes within inlined functions": 345,
+CHECK: "#bytes within functions": 524,
+CHECK: "#bytes within inlined functions": 415,
CHECK: "#params": 12,
CHECK-NEXT: "#params with source location": 12,
CHECK-NEXT: "#params with type": 12,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101025.339496.patch
Type: text/x-patch
Size: 3291 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210422/497204c4/attachment.bin>
More information about the llvm-commits
mailing list