[PATCH] D96871: [llvm-dwarfdump][locstats] Unify handling of inlined vars with no loc

Djordje Todorovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 17 08:04:33 PST 2021


djtodoro created this revision.
djtodoro added reviewers: aprantl, jmorse, 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.

Small optimization of the code -- No need to calculate any stats for NULL nodes, and also no need to call the `collectStatsForDie()` if it is the CU itself.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96871

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
@@ -448,6 +448,10 @@
                                   InlinedVarsTyMap &GlobalInlinedFnInfo,
                                   InlinedFnInstacesTy &InlinedFnsToBeProcessed,
                                   InlinedVarsTy *InlinedVarsPtr = nullptr) {
+  // Skip NULL nodes.
+  if (Die.isNULL())
+    return;
+
   const dwarf::Tag Tag = Die.getTag();
   // Skip function types.
   if (Tag == dwarf::DW_TAG_subroutine_type)
@@ -537,7 +541,7 @@
       else if (IsInlinedFunction && InlineDepth == 0)
         GlobalStats.InlineFunctionSize += BytesInThisScope;
     }
-  } else {
+  } else if (Tag != dwarf::DW_TAG_compile_unit) {
     // Not a scope, visit the Die itself. It could be a variable.
     collectStatsForDie(Die, FnPrefix, VarPrefix, BytesInScope, InlineDepth,
                        FnStatMap, GlobalStats, LocStats, InlinedVarsPtr);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96871.324313.patch
Type: text/x-patch
Size: 1056 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210217/3b94e4ce/attachment.bin>


More information about the llvm-commits mailing list