[llvm] f24dff3 - DWARFVerifier: Delay loading nested types in type dumping to improve performance
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 29 13:15:06 PST 2021
Author: David Blaikie
Date: 2021-12-29T13:12:47-08:00
New Revision: f24dff357b61cfed50361a09560990bb5f31dee2
URL: https://github.com/llvm/llvm-project/commit/f24dff357b61cfed50361a09560990bb5f31dee2
DIFF: https://github.com/llvm/llvm-project/commit/f24dff357b61cfed50361a09560990bb5f31dee2.diff
LOG: DWARFVerifier: Delay loading nested types in type dumping to improve performance
Avoid trying to resolve nested types that may not be needed because the name is
already provided by the outer DIE.
Added:
Modified:
llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
Removed:
################################################################################
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
index 5421b2d59a1b5..b3b2bec824578 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
@@ -215,15 +215,16 @@ struct DWARFTypePrinter {
OS << "void";
return DWARFDie();
}
- DWARFDie Inner = resolveReferencedType(D);
+ DWARFDie InnerDIE;
+ auto Inner = [&] { return InnerDIE = resolveReferencedType(D); };
const dwarf::Tag T = D.getTag();
switch (T) {
case DW_TAG_pointer_type: {
- appendPointerLikeTypeBefore(D, Inner, "*");
+ appendPointerLikeTypeBefore(D, Inner(), "*");
break;
}
case DW_TAG_subroutine_type: {
- appendQualifiedNameBefore(Inner);
+ appendQualifiedNameBefore(Inner());
if (Word) {
OS << ' ';
}
@@ -231,18 +232,18 @@ struct DWARFTypePrinter {
break;
}
case DW_TAG_array_type: {
- appendQualifiedNameBefore(Inner);
+ appendQualifiedNameBefore(Inner());
break;
}
case DW_TAG_reference_type:
- appendPointerLikeTypeBefore(D, Inner, "&");
+ appendPointerLikeTypeBefore(D, Inner(), "&");
break;
case DW_TAG_rvalue_reference_type:
- appendPointerLikeTypeBefore(D, Inner, "&&");
+ appendPointerLikeTypeBefore(D, Inner(), "&&");
break;
case DW_TAG_ptr_to_member_type: {
- appendQualifiedNameBefore(Inner);
- if (needsParens(Inner))
+ appendQualifiedNameBefore(Inner());
+ if (needsParens(InnerDIE))
OS << '(';
else if (Word)
OS << ' ';
@@ -284,7 +285,7 @@ struct DWARFTypePrinter {
const char *NamePtr = dwarf::toString(D.find(DW_AT_name), nullptr);
if (!NamePtr) {
appendTypeTagName(D.getTag());
- return Inner;
+ return DWARFDie();
}
Word = true;
StringRef Name = NamePtr;
@@ -317,7 +318,7 @@ struct DWARFTypePrinter {
break;
}
}
- return Inner;
+ return InnerDIE;
}
void appendUnqualifiedNameAfter(DWARFDie D, DWARFDie Inner,
More information about the llvm-commits
mailing list