[PATCH] D96871: [NFC][llvm-dwarfdump] Don't calculate unnecessary stats
Djordje Todorovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 22 00:32:01 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG52113451fbee: [NFC][llvm-dwarfdump] Don't calculate unnecessary stats (authored by djtodoro).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96871/new/
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
@@ -227,6 +227,11 @@
GlobalStats &GlobalStats,
LocationStats &LocStats,
InlinedVarsTy *InlinedVariables) {
+ const dwarf::Tag Tag = Die.getTag();
+ // Skip CU node.
+ if (Tag == dwarf::DW_TAG_compile_unit)
+ return;
+
bool HasLoc = false;
bool HasSrcLoc = false;
bool HasType = false;
@@ -234,23 +239,22 @@
uint64_t ScopeBytesCovered = 0;
uint64_t BytesEntryValuesCovered = 0;
auto &FnStats = FnStatMap[FnPrefix];
- bool IsParam = Die.getTag() == dwarf::DW_TAG_formal_parameter;
- bool IsLocalVar = Die.getTag() == dwarf::DW_TAG_variable;
- bool IsConstantMember = Die.getTag() == dwarf::DW_TAG_member &&
+ bool IsParam = Tag == dwarf::DW_TAG_formal_parameter;
+ bool IsLocalVar = Tag == dwarf::DW_TAG_variable;
+ bool IsConstantMember = Tag == dwarf::DW_TAG_member &&
Die.find(dwarf::DW_AT_const_value);
// For zero covered inlined variables the locstats will be
// calculated later.
bool DeferLocStats = false;
- if (Die.getTag() == dwarf::DW_TAG_call_site ||
- Die.getTag() == dwarf::DW_TAG_GNU_call_site) {
+ if (Tag == dwarf::DW_TAG_call_site || Tag == dwarf::DW_TAG_GNU_call_site) {
GlobalStats.CallSiteDIEs++;
return;
}
- if (Die.getTag() == dwarf::DW_TAG_call_site_parameter ||
- Die.getTag() == dwarf::DW_TAG_GNU_call_site_parameter) {
+ if (Tag == dwarf::DW_TAG_call_site_parameter ||
+ Tag == dwarf::DW_TAG_GNU_call_site_parameter) {
GlobalStats.CallSiteParamDIEs++;
return;
}
@@ -448,6 +452,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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96871.325384.patch
Type: text/x-patch
Size: 2232 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210222/b61b8d4d/attachment.bin>
More information about the llvm-commits
mailing list