[llvm] [SPIRV] Emit NonSemantic DebugTypeComposite and DebugTypeMember. (PR #211638)

Manuel Carrasco via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 24 04:39:52 PDT 2026


================
@@ -891,6 +1027,25 @@ void SPIRVNonSemanticDebugHandler::emitNonSemanticGlobalDebugInfo(
       DebugFunctionDeclarationRegs[SP] = *DeclReg;
   }
 
+  // Emit DebugTypeMember and DebugTypeComposite for each struct, class, or
+  // union. Each member is emitted before the composite that lists it, so the
+  // Members operand references already-defined ids. A member whose type is not
+  // in DebugTypeRegs is skipped.
+  for (const DICompositeType *CT : CompositeTypes) {
+    SmallVector<MCRegister> MemberRegs;
+    for (const DINode *Element : CT->getElements()) {
+      const auto *M = dyn_cast<DIDerivedType>(Element);
+      if (!M || M->getTag() != dwarf::DW_TAG_member)
+        continue;
+      if (auto MemberReg = emitDebugTypeMember(M, VoidTypeReg, I32TypeReg,
----------------
mgcarrasco wrote:

Is there any advantage of skipping members that are unsupported instead of skipping the entire type altogether when any of its members is unsupported? 

I'm trying to understanding if it could lead to a weird/unsound scenario trying to still emit the incomplete composite.

https://github.com/llvm/llvm-project/pull/211638


More information about the llvm-commits mailing list