[llvm] [DebugInfo] Verify DISubprogram has a type (PR #194556)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 27 23:59:02 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-webassembly
Author: Jiang Ning (JiangNingHX)
<details>
<summary>Changes</summary>
Require DISubprogram metadata to carry a non-null type in the verifier.
LangRef specifies that the `type:` field of `DISubprogram` points to a
`DISubroutineType`. This patch diagnoses malformed debug info where the field is
omitted or resolves to null, while preserving the existing wrong-type diagnostic
for non-DISubroutineType operands.
Update hand-written LLVM IR tests to use valid DISubprogram metadata where they
are not intentionally testing malformed debug info. These tests now use minimal
DISubroutineType metadata so the new verifier check does not mask their original
coverage.
Fixes #<!-- -->186557
---
Patch is 144.61 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/194556.diff
98 Files Affected:
- (modified) llvm/lib/IR/Verifier.cpp (+3-1)
- (modified) llvm/test/Assembler/dicompositetype-members.ll (+20-16)
- (modified) llvm/test/Assembler/diimportedentity.ll (+12-6)
- (modified) llvm/test/Assembler/dilexicalblock.ll (+9-7)
- (modified) llvm/test/Assembler/dilocalvariable-arg-large.ll (+5-3)
- (modified) llvm/test/Assembler/dilocalvariable.ll (+8-6)
- (modified) llvm/test/Assembler/dilocation.ll (+15-11)
- (modified) llvm/test/Assembler/disubprogram.ll (+4-4)
- (modified) llvm/test/Assembler/metadata.ll (+3-1)
- (modified) llvm/test/Bitcode/DILocalVariable-explicit-tags.ll (+11-7)
- (modified) llvm/test/Bitcode/DILocalVariable-explicit-tags.ll.bc ()
- (modified) llvm/test/Bitcode/DISubprogram-distinct-definitions.ll (+8-5)
- (modified) llvm/test/Bitcode/DISubprogram-distinct-definitions.ll.bc ()
- (modified) llvm/test/Bitcode/DISubprogram-v4.ll (+4-4)
- (modified) llvm/test/Bitcode/DISubprogram-v4.ll.bc ()
- (modified) llvm/test/Bitcode/debug-loc-again.ll (+3-1)
- (modified) llvm/test/Bitcode/dityperefs-3.8.ll (-1)
- (modified) llvm/test/CodeGen/AArch64/addrsig-macho.ll (+2-2)
- (modified) llvm/test/CodeGen/AArch64/arm64-instruction-mix-remarks.ll (+3-1)
- (modified) llvm/test/CodeGen/AArch64/arm64-summary-remarks.ll (+3-1)
- (modified) llvm/test/CodeGen/AArch64/fast-isel-dbg.ll (+3-1)
- (modified) llvm/test/CodeGen/AArch64/instr-ref-ldv.ll (+4-2)
- (modified) llvm/test/CodeGen/AMDGPU/GlobalISel/trunc-brc.ll (+3-1)
- (modified) llvm/test/CodeGen/AMDGPU/opencl-printf-unsupported.ll (+3-1)
- (modified) llvm/test/CodeGen/AMDGPU/sched-crash-dbg-value.mir (+4-2)
- (modified) llvm/test/CodeGen/AMDGPU/vi-removed-intrinsics.ll (+3-1)
- (modified) llvm/test/CodeGen/MIR/X86/stack-object-debug-info.mir (+4-2)
- (modified) llvm/test/CodeGen/WebAssembly/lower-em-sjlj-debuginfo.ll (+3-1)
- (modified) llvm/test/CodeGen/X86/basic-block-sections-clusters-error.ll (+3-2)
- (modified) llvm/test/CodeGen/X86/basic-block-sections-module1.ll (+3-1)
- (modified) llvm/test/CodeGen/X86/basic-block-sections-module2.ll (+6-4)
- (modified) llvm/test/CodeGen/X86/fixed-stack-di-mir.ll (+4-2)
- (modified) llvm/test/CodeGen/X86/pr57673.ll (+5-3)
- (modified) llvm/test/CodeGen/X86/select-optimize.ll (+3-1)
- (modified) llvm/test/CodeGen/X86/tail-merge-debugloc.ll (+3-1)
- (modified) llvm/test/DebugInfo/AMDGPU/bitcast-store-combine-debugloc.ll (+3-1)
- (modified) llvm/test/DebugInfo/ARM/move-dbg-value-after-value-list.mir (+12-10)
- (modified) llvm/test/DebugInfo/ARM/move-dbg-value-lists.mir (+13-11)
- (modified) llvm/test/DebugInfo/ARM/move-dbg-value-same-reg.mir (+3-1)
- (modified) llvm/test/DebugInfo/ARM/move-dbg-values.mir (+12-10)
- (modified) llvm/test/DebugInfo/Generic/2010-03-19-DbgDeclare.ll (+3-1)
- (modified) llvm/test/DebugInfo/Generic/dbg-value-lower-linenos.ll (+5-3)
- (modified) llvm/test/DebugInfo/Generic/debuginfofinder-retained-nodes.ll (+5-3)
- (modified) llvm/test/DebugInfo/Generic/invalid.ll (+7-5)
- (modified) llvm/test/DebugInfo/Generic/sroa-extract-bits.ll (+4-2)
- (modified) llvm/test/DebugInfo/Generic/verifier-invalid-disubprogram.ll (+18-16)
- (modified) llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir (+1-1)
- (modified) llvm/test/DebugInfo/MIR/X86/dbgcall-site-lea-interpretation.mir (+2-2)
- (modified) llvm/test/DebugInfo/MIR/X86/dbginfo-entryvals.mir (+1-1)
- (modified) llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir (+2-2)
- (modified) llvm/test/DebugInfo/MIR/X86/machine-cse.mir (+4-2)
- (modified) llvm/test/DebugInfo/X86/instr-ref-opt-bisect2.ll (+3-1)
- (modified) llvm/test/DebugInfo/X86/pr40427.ll (+3-1)
- (modified) llvm/test/DebugInfo/X86/sunk-compare.ll (+3-1)
- (modified) llvm/test/DebugInfo/sroa-handle-dbg-value.ll (+2-2)
- (modified) llvm/test/Instrumentation/AddressSanitizer/stack_layout.ll (+4-2)
- (modified) llvm/test/Transforms/AggressiveInstCombine/AArch64/combine_ignore_debug.ll (+3-1)
- (modified) llvm/test/Transforms/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll (+4-2)
- (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/dbg.ll (+5-3)
- (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll (+4-2)
- (modified) llvm/test/Transforms/CallSiteSplitting/callsite-split-debug.ll (+3-1)
- (modified) llvm/test/Transforms/CodeGenPrepare/X86/cast-debuginfo-salvage.ll (+4-2)
- (modified) llvm/test/Transforms/Coroutines/declare-value.ll (+5-3)
- (modified) llvm/test/Transforms/Inline/debug-invoke.ll (+3-1)
- (modified) llvm/test/Transforms/InstCombine/assume.ll (+3-1)
- (modified) llvm/test/Transforms/InstCombine/consecutive-fences.ll (+3-1)
- (modified) llvm/test/Transforms/LICM/hoist-phi-metadata.ll (+4-2)
- (modified) llvm/test/Transforms/LoopVectorize/debugloc.ll (+2-2)
- (modified) llvm/test/Transforms/LoopVectorize/discriminator.ll (+3-1)
- (modified) llvm/test/Transforms/Mem2Reg/dbg_declare_to_value_conversions.ll (+3-1)
- (modified) llvm/test/Transforms/PGOProfile/memprof_annotate_indirect_call.test (+6-2)
- (modified) llvm/test/Transforms/SLPVectorizer/X86/debug-info-salvage.ll (+4-2)
- (modified) llvm/test/Transforms/SLPVectorizer/X86/phi-node-deletion.ll (+4-2)
- (modified) llvm/test/Transforms/SLPVectorizer/X86/schedule_budget_debug_info.ll (+3-1)
- (modified) llvm/test/Transforms/SROA/dbg-single-piece.ll (+3-1)
- (modified) llvm/test/Transforms/SampleProfile/cold-indirect-call.ll (+5-3)
- (modified) llvm/test/Transforms/SampleProfile/csspgo-inline-icall.ll (+7-5)
- (modified) llvm/test/Transforms/SampleProfile/early-inline.ll (+6-4)
- (modified) llvm/test/Transforms/SampleProfile/function_metadata.ll (+1-1)
- (modified) llvm/test/Transforms/SampleProfile/indirect-call-gcc.ll (+3-1)
- (modified) llvm/test/Transforms/SampleProfile/indirect-call.ll (+23-21)
- (modified) llvm/test/Transforms/SampleProfile/inline-callee-update.ll (+6-4)
- (modified) llvm/test/Transforms/SimplifyCFG/X86/hoist-loads-stores-with-cf.ll (+3-1)
- (modified) llvm/test/Transforms/SimplifyCFG/X86/remove-debug.ll (+1-1)
- (modified) llvm/test/Transforms/SimplifyCFG/pr39807.ll (+4-2)
- (modified) llvm/test/Transforms/SimplifyCFG/tail-merge-noreturn.ll (+3-1)
- (modified) llvm/test/Transforms/StripSymbols/find-live-cu.ll (+4-2)
- (modified) llvm/test/Transforms/Util/trivial-auto-var-init-call.ll (+3-1)
- (modified) llvm/test/Transforms/Util/trivial-auto-var-init-store.ll (+3-1)
- (modified) llvm/test/Transforms/Util/trivial-auto-var-init-unknown.ll (+3-1)
- (modified) llvm/test/Transforms/WholeProgramDevirt/devirt_single_after_filtering_unreachable_function.ll (+3-1)
- (added) llvm/test/Verifier/DISubprogram-type.ll (+27)
- (modified) llvm/test/Verifier/verify-dwarf-no-operands.ll (+3-2)
- (modified) llvm/test/tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll (+2-2)
- (modified) llvm/unittests/IR/DebugInfoTest.cpp (+6-4)
- (modified) llvm/unittests/IR/ModuleTest.cpp (+6-2)
- (modified) llvm/unittests/IR/VerifierTest.cpp (+2-1)
- (modified) llvm/unittests/Transforms/Utils/CloningTest.cpp (+20-10)
``````````diff
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index fe1854384e693..4b944266f6c9b 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -1640,7 +1640,9 @@ void Verifier::visitDISubprogram(const DISubprogram &N) {
CheckDI(isa<DIFile>(F), "invalid file", &N, F);
else
CheckDI(N.getLine() == 0, "line specified with no file", &N, N.getLine());
- if (auto *T = N.getRawType())
+ auto *T = N.getRawType();
+ CheckDI(T, "DISubprogram requires a non-null type", &N);
+ if (T)
CheckDI(isa<DISubroutineType>(T), "invalid subroutine type", &N, T);
CheckDI(isType(N.getRawContainingType()), "invalid containing type", &N,
N.getRawContainingType());
diff --git a/llvm/test/Assembler/dicompositetype-members.ll b/llvm/test/Assembler/dicompositetype-members.ll
index f5471bda840cc..c69bc1413ae9b 100644
--- a/llvm/test/Assembler/dicompositetype-members.ll
+++ b/llvm/test/Assembler/dicompositetype-members.ll
@@ -16,39 +16,43 @@
; CHECK-NEXT: !3 = !DICompositeType(tag: DW_TAG_structure_type, name: "has-uuid",{{.*}}, identifier: "uuid")
; CHECK-NEXT: !4 = !DIDerivedType(tag: DW_TAG_member, name: "field1", scope: !3, file: !1
; CHECK-NEXT: !5 = !DIDerivedType(tag: DW_TAG_member, name: "field2", scope: !3, file: !1
-; CHECK-NEXT: !6 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !3, file: !1
-; CHECK-NEXT: !7 = !DISubprogram(name: "foo", linkageName: "foo2", scope: !3, file: !1
+; CHECK-NEXT: !6 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !3, file: !1, type: !7, spFlags: 0)
+; CHECK-NEXT: !7 = !DISubroutineType(types: !8)
+; CHECK-NEXT: !8 = !{null}
+; CHECK-NEXT: !9 = !DISubprogram(name: "foo", linkageName: "foo2", scope: !3, file: !1, type: !7, spFlags: 0)
!3 = !DICompositeType(tag: DW_TAG_structure_type, name: "has-uuid", file: !1, line: 2, size: 64, align: 32, identifier: "uuid")
!4 = !DIDerivedType(tag: DW_TAG_member, name: "field1", scope: !3, file: !1, line: 4, baseType: !0, size: 32, align: 32, offset: 32)
!5 = !DIDerivedType(tag: DW_TAG_member, name: "field2", scope: !3, file: !1, line: 4, baseType: !0, size: 32, align: 32, offset: 32)
-!6 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !3, file: !1, isDefinition: false)
-!7 = !DISubprogram(name: "foo", linkageName: "foo2", scope: !3, file: !1, isDefinition: false)
+!6 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !3, file: !1, isDefinition: false, type: !18)
+!7 = !DISubprogram(name: "foo", linkageName: "foo2", scope: !3, file: !1, isDefinition: false, type: !18)
+!18 = !DISubroutineType(types: !19)
+!19 = !{null}
; Define an un-identified type with fields and functions.
-; CHECK-NEXT: !8 = !DICompositeType(tag: DW_TAG_structure_type, name: "no-uuid", file: !1
-; CHECK-NEXT: !9 = !DIDerivedType(tag: DW_TAG_member, name: "field1", scope: !8, file: !1
-; CHECK-NEXT: !10 = !DIDerivedType(tag: DW_TAG_member, name: "field2", scope: !8, file: !1
-; CHECK-NEXT: !11 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !8, file: !1
-; CHECK-NEXT: !12 = !DISubprogram(name: "foo", linkageName: "foo2", scope: !8, file: !1
+; CHECK-NEXT: !10 = !DICompositeType(tag: DW_TAG_structure_type, name: "no-uuid", file: !1
+; CHECK-NEXT: !11 = !DIDerivedType(tag: DW_TAG_member, name: "field1", scope: !10, file: !1
+; CHECK-NEXT: !12 = !DIDerivedType(tag: DW_TAG_member, name: "field2", scope: !10, file: !1
+; CHECK-NEXT: !13 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !10, file: !1, type: !7, spFlags: 0)
+; CHECK-NEXT: !14 = !DISubprogram(name: "foo", linkageName: "foo2", scope: !10, file: !1, type: !7, spFlags: 0)
!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "no-uuid", file: !1, line: 2, size: 64, align: 32)
!9 = !DIDerivedType(tag: DW_TAG_member, name: "field1", scope: !8, file: !1, line: 4, baseType: !0, size: 32, align: 32, offset: 32)
!10 = !DIDerivedType(tag: DW_TAG_member, name: "field2", scope: !8, file: !1, line: 4, baseType: !0, size: 32, align: 32, offset: 32)
-!11 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !8, file: !1, isDefinition: false)
-!12 = !DISubprogram(name: "foo", linkageName: "foo2", scope: !8, file: !1, isDefinition: false)
+!11 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !8, file: !1, isDefinition: false, type: !18)
+!12 = !DISubprogram(name: "foo", linkageName: "foo2", scope: !8, file: !1, isDefinition: false, type: !18)
; Add duplicate fields and members of "no-uuid" in a different file. These
; should stick around, since "no-uuid" does not have an "identifier:" field.
-; CHECK-NEXT: !13 = !DIDerivedType(tag: DW_TAG_member, name: "field1", scope: !8, file: !2,
-; CHECK-NEXT: !14 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !8, file: !2,
+; CHECK-NEXT: !15 = !DIDerivedType(tag: DW_TAG_member, name: "field1", scope: !10, file: !2,
+; CHECK-NEXT: !16 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !10, file: !2, type: !7, spFlags: 0)
!13 = !DIDerivedType(tag: DW_TAG_member, name: "field1", scope: !8, file: !2, line: 4, baseType: !0, size: 32, align: 32, offset: 32)
-!14 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !8, file: !2, isDefinition: false)
+!14 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !8, file: !2, isDefinition: false, type: !18)
; Add duplicate fields and members of "has-uuid" in a different file. These
; should be merged.
!15 = !DIDerivedType(tag: DW_TAG_member, name: "field1", scope: !3, file: !2, line: 4, baseType: !0, size: 32, align: 32, offset: 32)
-!16 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !3, file: !2, isDefinition: false)
+!16 = !DISubprogram(name: "foo", linkageName: "foo1", scope: !3, file: !2, isDefinition: false, type: !18)
-; CHECK-NEXT: !15 = !{!4, !6}
+; CHECK-NEXT: !17 = !{!4, !6}
; CHECK-NOT: !DIDerivedType
; CHECK-NOT: !DISubprogram
!17 = !{!15, !16}
diff --git a/llvm/test/Assembler/diimportedentity.ll b/llvm/test/Assembler/diimportedentity.ll
index 6a0e1eb931c1a..a5c76afcca218 100644
--- a/llvm/test/Assembler/diimportedentity.ll
+++ b/llvm/test/Assembler/diimportedentity.ll
@@ -1,28 +1,34 @@
; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
; RUN: verify-uselistorder %s
-; CHECK: !named = !{!0, !3, !4, !5, !5}
+; CHECK: !named = !{!0, !5, !6, !7, !7}
!named = !{!0, !3, !4, !5, !6}
!llvm.module.flags = !{!7}
!llvm.dbg.cu = !{!1}
-; CHECK: !0 = distinct !DISubprogram({{.*}})
-!0 = distinct !DISubprogram(name: "foo", isDefinition: true, unit: !1)
+; CHECK: !0 = distinct !DISubprogram({{.*}}, type: !1{{.*}})
+!0 = distinct !DISubprogram(name: "foo", isDefinition: true, unit: !1, type: !8)
+!8 = !DISubroutineType(types: !9)
+!9 = !{null}
!1 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang",
file: !2,
isOptimized: true, flags: "-O2",
splitDebugFilename: "abc.debug", emissionKind: 2)
!2 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
-; CHECK: !3 = !DICompositeType({{.*}})
+; CHECK: !1 = !DISubroutineType(types: !2)
+; CHECK: !2 = !{null}
+; CHECK: !3 = distinct !DICompileUnit
+; CHECK: !4 = !DIFile
+; CHECK: !5 = !DICompositeType({{.*}})
!3 = !DICompositeType(tag: DW_TAG_structure_type, name: "Class", size: 32, align: 32)
-; CHECK-NEXT: !4 = !DIImportedEntity(tag: DW_TAG_imported_module, name: "foo", scope: !0, entity: !1, file: !2, line: 7)
+; CHECK-NEXT: !6 = !DIImportedEntity(tag: DW_TAG_imported_module, name: "foo", scope: !0, entity: !3, file: !4, line: 7)
!4 = !DIImportedEntity(tag: DW_TAG_imported_module, name: "foo", scope: !0,
entity: !1, file: !2, line: 7)
-; CHECK-NEXT: !5 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !0)
+; CHECK-NEXT: !7 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !0)
!5 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !0)
!6 = !DIImportedEntity(tag: DW_TAG_imported_module, name: "", scope: !0, entity: null,
line: 0)
diff --git a/llvm/test/Assembler/dilexicalblock.ll b/llvm/test/Assembler/dilexicalblock.ll
index 77a8650830d4d..29cca5b9aa2b3 100644
--- a/llvm/test/Assembler/dilexicalblock.ll
+++ b/llvm/test/Assembler/dilexicalblock.ll
@@ -1,7 +1,7 @@
; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
; RUN: verify-uselistorder %s
-; CHECK: !named = !{!0, !1, !2, !3, !4, !4, !5, !6, !7, !7, !8}
+; CHECK: !named = !{!0, !1, !2, !5, !6, !6, !7, !8, !9, !9, !10}
!named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10}
!llvm.module.flags = !{!11}
@@ -12,21 +12,23 @@
isOptimized: true, flags: "-O2",
splitDebugFilename: "abc.debug", emissionKind: 2)
!1 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
-!2 = distinct !DISubprogram(name: "foo", scope: !1, unit: !0)
+!2 = distinct !DISubprogram(name: "foo", scope: !1, unit: !0, type: !12)
+!12 = !DISubroutineType(types: !13)
+!13 = !{null}
-; CHECK: !3 = !DILexicalBlock(scope: !2, file: !1, line: 7, column: 35)
+; CHECK: !5 = !DILexicalBlock(scope: !2, file: !1, line: 7, column: 35)
!3 = !DILexicalBlock(scope: !2, file: !1, line: 7, column: 35)
-; CHECK: !4 = !DILexicalBlock(scope: !2)
+; CHECK: !6 = !DILexicalBlock(scope: !2)
!4 = !DILexicalBlock(scope: !2)
!5 = !DILexicalBlock(scope: !2, file: null, line: 0, column: 0)
-; CHECK: !5 = !DILexicalBlockFile(scope: !3, file: !1, discriminator: 0)
-; CHECK: !6 = !DILexicalBlockFile(scope: !3, file: !1, discriminator: 1)
+; CHECK: !7 = !DILexicalBlockFile(scope: !5, file: !1, discriminator: 0)
+; CHECK: !8 = !DILexicalBlockFile(scope: !5, file: !1, discriminator: 1)
!6 = !DILexicalBlockFile(scope: !3, file: !1, discriminator: 0)
!7 = !DILexicalBlockFile(scope: !3, file: !1, discriminator: 1)
-; CHECK: !7 = !DILexicalBlockFile(scope: !3, discriminator: 7)
+; CHECK: !9 = !DILexicalBlockFile(scope: !5, discriminator: 7)
!8 = !DILexicalBlockFile(scope: !3, discriminator: 7)
!9 = !DILexicalBlockFile(scope: !3, file: null, discriminator: 7)
!10 = distinct !{}
diff --git a/llvm/test/Assembler/dilocalvariable-arg-large.ll b/llvm/test/Assembler/dilocalvariable-arg-large.ll
index 91cf0e2c00e71..e4bbdb1c480b4 100644
--- a/llvm/test/Assembler/dilocalvariable-arg-large.ll
+++ b/llvm/test/Assembler/dilocalvariable-arg-large.ll
@@ -1,20 +1,22 @@
; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
; RUN: verify-uselistorder %s
-; CHECK: !named = !{!0, !3}
+; CHECK: !named = !{!0, !5}
!named = !{!0, !3}
!llvm.module.flags = !{!4}
!llvm.dbg.cu = !{!1}
-!0 = distinct !DISubprogram(unit: !1)
+!0 = distinct !DISubprogram(unit: !1, type: !5)
!1 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang",
file: !2,
isOptimized: true, flags: "-O2",
splitDebugFilename: "abc.debug", emissionKind: 2)
!2 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
-; CHECK: !3 = !DILocalVariable(name: "foo", arg: 65535, scope: !0)
+; CHECK: !5 = !DILocalVariable(name: "foo", arg: 65535, scope: !0)
!3 = !DILocalVariable(name: "foo", arg: 65535, scope: !0)
!4 = !{i32 2, !"Debug Info Version", i32 3}
+!5 = !DISubroutineType(types: !6)
+!6 = !{null}
diff --git a/llvm/test/Assembler/dilocalvariable.ll b/llvm/test/Assembler/dilocalvariable.ll
index 067afaa2f3005..de8f93363f7d9 100644
--- a/llvm/test/Assembler/dilocalvariable.ll
+++ b/llvm/test/Assembler/dilocalvariable.ll
@@ -3,13 +3,13 @@
@foo = global i32 0
-; CHECK: !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9}
+; CHECK: !named = !{!0, !3, !4, !5, !6, !7, !8, !9, !10, !11}
!named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9}
!llvm.module.flags = !{!10}
!llvm.dbg.cu = !{!1}
-!0 = distinct !DISubprogram(unit: !1)
+!0 = distinct !DISubprogram(unit: !1, type: !11)
!1 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang",
file: !2,
isOptimized: true, flags: "-O2",
@@ -18,18 +18,20 @@
!3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!4 = !DILocation(scope: !0)
-; CHECK: !5 = !DILocalVariable(name: "foo", arg: 3, scope: !0, file: !2, line: 7, type: !3, flags: DIFlagArtificial, align: 32)
-; CHECK: !6 = !DILocalVariable(name: "foo", scope: !0, file: !2, line: 7, type: !3, flags: DIFlagArtificial)
+; CHECK: !7 = !DILocalVariable(name: "foo", arg: 3, scope: !0, file: !4, line: 7, type: !5, flags: DIFlagArtificial, align: 32)
+; CHECK: !8 = !DILocalVariable(name: "foo", scope: !0, file: !4, line: 7, type: !5, flags: DIFlagArtificial)
!5 = !DILocalVariable(name: "foo", arg: 3,
scope: !0, file: !2, line: 7, type: !3,
flags: DIFlagArtificial, align: 32)
!6 = !DILocalVariable(name: "foo", scope: !0,
file: !2, line: 7, type: !3, flags: DIFlagArtificial)
-; CHECK: !7 = !DILocalVariable(arg: 1, scope: !0)
-; CHECK: !8 = !DILocalVariable(scope: !0)
+; CHECK: !9 = !DILocalVariable(arg: 1, scope: !0)
+; CHECK: !10 = !DILocalVariable(scope: !0)
!7 = !DILocalVariable(scope: !0, arg: 1)
!8 = !DILocalVariable(scope: !0)
!9 = distinct !{}
!10 = !{i32 2, !"Debug Info Version", i32 3}
+!11 = !DISubroutineType(types: !12)
+!12 = !{null}
diff --git a/llvm/test/Assembler/dilocation.ll b/llvm/test/Assembler/dilocation.ll
index 4eb46e50597a7..5251366b09c76 100644
--- a/llvm/test/Assembler/dilocation.ll
+++ b/llvm/test/Assembler/dilocation.ll
@@ -1,40 +1,44 @@
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
; RUN: verify-uselistorder %s
-; CHECK: !named = !{!0, !2, !3, !3, !4, !4, !5, !5, !6, !7, !8}
+; CHECK: !named = !{!0, !4, !5, !5, !6, !6, !7, !7, !8, !9, !10}
!named = !{!0, !2, !3, !4, !5, !6, !7, !8, !9, !10, !11}
!llvm.module.flags = !{!12}
!llvm.dbg.cu = !{!1}
-; CHECK: !0 = distinct !DISubprogram(
-!0 = distinct !DISubprogram(unit: !1)
-; CHECK: !1 = distinct !DICompileUnit
+; CHECK: !0 = distinct !DISubprogram(scope: null, type: !1, spFlags: DISPFlagDefinition, unit: !3)
+!0 = distinct !DISubprogram(unit: !1, type: !13)
+; CHECK: !1 = !DISubroutineType(types: !2)
+; CHECK: !2 = !{null}
+; CHECK: !3 = distinct !DICompileUnit
!1 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang",
file: !2,
isOptimized: true, flags: "-O2",
splitDebugFilename: "abc.debug", emissionKind: 2)
-; CHECK: !2 = !DIFile
+; CHECK: !4 = !DIFile
!2 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
-; CHECK-NEXT: !3 = !DILocation(line: 3, column: 7, scope: !0)
+; CHECK: !5 = !DILocation(line: 3, column: 7, scope: !0)
!3 = !DILocation(line: 3, column: 7, scope: !0)
!4 = !DILocation(scope: !0, column: 7, line: 3)
-; CHECK-NEXT: !4 = !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !3)
+; CHECK: !6 = !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !5)
!5 = !DILocation(scope: !0, inlinedAt: !3, column: 7, line: 3)
!6 = !DILocation(column: 7, line: 3, scope: !0, inlinedAt: !3)
-; CHECK-NEXT: !5 = !DILocation(line: 0, scope: !0)
+; CHECK: !7 = !DILocation(line: 0, scope: !0)
!7 = !DILocation(scope: !0)
!8 = !DILocation(scope: !0, column: 0, line: 0)
-; CHECK-NEXT: !6 = !DILocation(line: 4294967295, column: 65535, scope: !0)
+; CHECK: !8 = !DILocation(line: 4294967295, column: 65535, scope: !0)
!9 = !DILocation(line: 4294967295, column: 65535, scope: !0)
!10 = !DILocation(scope: !0, column: 0, line: 0, isImplicitCode: true)
!11 = !DILocation(scope: !0, column: 0, line: 1, isImplicitCode: false)
-; CHECK-NEXT: !7 = !DILocation(line: 0, scope: !0, isImplicitCode: true)
-; CHECK-NEXT: !8 = !DILocation(line: 1, scope: !0)
+; CHECK: !9 = !DILocation(line: 0, scope: !0, isImplicitCode: true)
+; CHECK: !10 = !DILocation(line: 1, scope: !0)
!12 = !{i32 2, !"Debug Info Version", i32 3}
+!13 = !DISubroutineType(types: !14)
+!14 = !{null}
diff --git a/llvm/test/Assembler/disubprogram.ll b/llvm/test/Assembler/disubprogram.ll
index 99a747d15e7dd..aa2ec67050d64 100644
--- a/llvm/test/Assembler/disubprogram.ll
+++ b/llvm/test/Assembler/disubprogram.ll
@@ -17,16 +17,16 @@ define void @_Z3foov() !dbg !9 {
!5 = distinct !{}
!6 = distinct !{}
-; CHECK: !7 = distinct !DISubprogram(scope: null, spFlags: DISPFlagDefinition, unit: !8)
-!7 = distinct !DISubprogram(unit: !8)
+; CHECK: !7 = distinct !DISubprogram(scope: null, type: !3, spFlags: DISPFlagDefinition, unit: !8)
+!7 = distinct !DISubprogram(unit: !8, type: !3)
!8 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang",
file: !2,
isOptimized: true, flags: "-O2",
splitDebugFilename: "abc.debug", emissionKind: 2)
-; CHECK: !9 = distinct !DISubprogram(scope: null, spFlags: 0)
-!9 = distinct !DISubprogram(isDefinition: false)
+; CHECK: !9 = distinct !DISubprogram(scope: null, type: !3, spFlags: 0)
+!9 = distinct !DISubprogram(isDefinition: false, type: !3)
; CHECK: !10 = distinct !DISubprogram(name: "foo", linkageName: "_Zfoov", scope: !1, file: !2, line: 7, type: !3, scopeLine: 8, containingType: !4, virtualIndex: 10, thisAdjustment: 3, flags: DIFlagPrototyped | DIFlagNoReturn, spFlags: DISPFlagPureVirtual | DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !8, templateParams: !5, declaration: !9, retainedNodes: !6)
!10 = distinct !DISubprogram(name: "foo", linkageName: "_Zfoov", scope: !1,
diff --git a/llvm/test/Assembler/metadata.ll b/llvm/test/Assembler/metadata.ll
index b1fb720eb31f9..6ad78c21c33ac 100644
--- a/llvm/test/Assembler/metadata.ll
+++ b/llvm/test/Assembler/metadata.ll
@@ -47,10 +47,12 @@ define void @test_attachment_name() {
; CHECK: [[M1]] = distinct !DISubprogram
; CHECK: [[M4]] = distinct !{}
+!8 = !{null}
+!9 = !DISubroutineType(types: !8)
!llvm.module.flags = !{!7}
!llvm.dbg.cu = !{!5}
!0 = !DILocation(line: 662302, column: 26, scope: !1)
-!1 = distinct !DISubprogram(name: "foo", isDefinition: true, unit: !5)
+!1 = distinct !DISubprogram(name: "foo", isDefinition: true, type: !9, unit: !5)
!2 = distinct !{}
!3 = distinct !{}
!4 = distinct !{}
diff --git a/llvm/test/Bitcode/DILocalVariable-explicit-tags.ll b/llvm/test/Bitcode/DILocalVariable-explicit-tags.ll
index a42884cc42728..20dc66cd8349b 100644
--- a/llvm/test/Bitcode/DILocalVariable-explicit-tags.ll
+++ b/llvm/test/Bitcode/DILocalVariable-explicit-tags.ll
@@ -1,9 +1,11 @@
-; Bitcode compiled with 3.7_rc2. 3.7 had redundant (but mandatory) tag fields
-; on DILocalVariable.
+; Bitcode originally compiled with 3.7_rc2. 3.7 had redundant (but
+; mandatory) tag fields on DILocalVariable.
;
; RUN: llvm-dis < %s.bc -o - | llvm-as | llvm-dis | FileCheck %s
-; CHECK: ![[SP:[0-9]+]] = distinct !DISubprogram(name: "foo",{{.*}} retainedNodes: ![[VARS:[0-9]+]]
+; CHECK: ![[SP:[0-9]+]] = distinct !DISubprogram(name: "foo",{{.*}} type: ![[TYPE:[0-9]+]],{{.*}} retainedNodes: ![[VARS:[0-9]+]]
+; CHECK: ![[TYPE]] = !DISubroutineType(types: ![[ARGS:[0-9]+]])
+; CHECK: ![[ARGS]] = !{null}
; CHECK: ![[VARS]] = !{![[PARAM:[0-9]+]], ![[AUTO:[0-9]+]]}
; CHECK: ![[PARAM]] = !DILocalVariable(name: "param", arg: 1, scope: ![[SP]])
; CHECK: ![[AUTO]] = !DILocalVariable(name: "auto", scope: ![[SP]])
@@ -13,10 +15,12 @@
!llvm.module.flags = !{!6}
!llvm.dbg.cu = !{!4}
-!0 = distinct !DISubprogram(name: "foo", scope: null, isLocal: false, isDefinition: true, isOptimized: false, retainedNodes: !1)
+!0 = distinct !DISubprogram(name: "foo", scope: null, type: !7, isLocal: false, isDefinition: true, isOptimized: false, unit: !4, retainedNodes: !1)
!1 = !{!2, !3}
-!2 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "param", arg: 1, scope: !0)
-!3 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "auto", scope: !0)
-!4 = distinct !DICompileUnit(language: DW_LANG_C99, file: !5, subprograms: !{!0})
+!2 = !DILocalVariable(name: "param", arg: 1, scope: !0)
+!3 = !DILocalVariable(name: "auto", scope: !0)
+!4 = distinct !DICompileUnit(language: DW_LANG_C99, file: !5)
!5 = !DIFile(filename: "source.c", directory: "/dir")
!6 = !{i32 1, !"Debug Info Version", i32 3}
+!7 = !DISubroutineType(types: !8)
+!8 = !{null}
diff --git a/llvm/test/Bitcode/DILocalVariable-explicit-tags.ll.bc b/llvm/test/Bitcode/DILocalVariable-explicit-tags.ll.bc...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/194556
More information about the llvm-commits
mailing list