[PATCH] D61079: Skip type units/type uniquing when we know we're only emitting the type once (vtable-based emission when triggered by a strong vtable, with -fno-standalone-debug)

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 24 10:23:34 PDT 2019


dblaikie created this revision.
dblaikie added a reviewer: aprantl.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

(this would regress size without a corresponding LLVM change that avoids
putting other user defined types inside type units when they aren't in
their own type units - instead emitting declarations inside the type
unit and a definition in the primary CU)

Adrian - can you tell me whether the changes to the implicit modular debug info tests are OK? What does that feature use the 'identifier' for, if anything?


Repository:
  rC Clang

https://reviews.llvm.org/D61079

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/Modules/ExtDebugInfo.cpp
  test/Modules/ModuleDebugInfo.cpp


Index: test/Modules/ModuleDebugInfo.cpp
===================================================================
--- test/Modules/ModuleDebugInfo.cpp
+++ test/Modules/ModuleDebugInfo.cpp
@@ -119,8 +119,7 @@
 
 // CHECK: ![[A:.*]] = {{.*}}!DICompositeType(tag: DW_TAG_class_type, name: "A",
 // CHECK-SAME:                               elements:
-// CHECK-SAME:                               vtableHolder: ![[A]],
-// CHECK-SAME:                               identifier: "_ZTS1A")
+// CHECK-SAME:                               vtableHolder: ![[A]])
 
 // CHECK: ![[DERIVED:.*]] = {{.*}}!DICompositeType(tag: DW_TAG_class_type, name: "Derived",
 // CHECK-SAME:                                     identifier: "_ZTS7Derived")
Index: test/Modules/ExtDebugInfo.cpp
===================================================================
--- test/Modules/ExtDebugInfo.cpp
+++ test/Modules/ExtDebugInfo.cpp
@@ -214,7 +214,7 @@
 // CHECK-PCH:                dwoId: 18446744073709551614
 
 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A",
-// CHECK-SAME:             DIFlagFwdDecl, identifier: "_ZTS1A")
+// CHECK-SAME:             DIFlagFwdDecl)
 
 // There is a full definition of the type available in the module.
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Virtual",
Index: lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -915,6 +915,11 @@
 
   if (!needsTypeIdentifier(TD, CGM, TheCU))
     return Identifier;
+  if (const auto *RD = dyn_cast<CXXRecordDecl>(TD))
+    if (RD->getDefinition())
+      if (RD->isDynamicClass() &&
+          CGM.getVTableLinkage(RD) == llvm::GlobalValue::ExternalLinkage)
+        return Identifier;
 
   // TODO: This is using the RTTI name. Is there a better way to get
   // a unique string for a type?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61079.196484.patch
Type: text/x-patch
Size: 1873 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190424/54aa134c/attachment.bin>


More information about the cfe-commits mailing list