xref: /llvm-project/llvm/test/DebugInfo/X86/empty-metadata-dbg-declare.ll (revision 5ee088134fb87f7d716c58fa65beb11fb6afcb22)
1; RUN: llc %s -stop-after=finalize-isel -o - | FileCheck %s --implicit-check-not=DBG
2; RUN: llc --try-experimental-debuginfo-iterators %s -stop-after=finalize-isel -o - | FileCheck %s --implicit-check-not=DBG
3
4;; Check that a single "empty metadata" dbg.declare doesn't accidentally cause
5;; other dbg.declares in the function to go missing.
6
7; CHECK: ![[f:[0-9]+]] = !DILocalVariable(name: "f",
8
9; CHECK: stack:
10; CHECK-NEXT: - { id: 0, name: f, type: default, offset: 0, size: 4, alignment: 4,
11; CHECK-NEXT:     stack-id: default, callee-saved-register: '', callee-saved-restored: true,
12; CHECK-NEXT:     debug-info-variable: '![[f]]', debug-info-expression: '!DIExpression()',
13; CHECK-NEXT:     debug-info-location: '{{.+}}' }
14; CHECK-NEXT: entry_values:
15
16target triple = "x86_64-unknown-linux-gnu"
17
18define dso_local void @fun() local_unnamed_addr #0 !dbg !9 {
19entry:
20  %f = alloca float
21  call void @llvm.dbg.declare(metadata ptr %f, metadata !13, metadata !DIExpression()), !dbg !15
22  call void @llvm.dbg.declare(metadata !19, metadata !18, metadata !DIExpression()), !dbg !15
23  ret void, !dbg !17
24}
25
26declare void @llvm.dbg.declare(metadata, metadata, metadata)
27
28!llvm.dbg.cu = !{!0}
29!llvm.module.flags = !{!2, !3, !4, !5, !6, !7}
30!llvm.ident = !{!8}
31
32!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 16.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
33!1 = !DIFile(filename: "test.cpp", directory: "/")
34!2 = !{i32 7, !"Dwarf Version", i32 5}
35!3 = !{i32 2, !"Debug Info Version", i32 3}
36!4 = !{i32 1, !"wchar_size", i32 4}
37!5 = !{i32 8, !"PIC Level", i32 2}
38!6 = !{i32 7, !"PIE Level", i32 2}
39!7 = !{i32 7, !"uwtable", i32 2}
40!8 = !{!"clang version 16.0.0"}
41!9 = distinct !DISubprogram(name: "fun", linkageName: "fun", scope: !1, file: !1, line: 2, type: !10, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12)
42!10 = !DISubroutineType(types: !11)
43!11 = !{null}
44!12 = !{!13}
45!13 = !DILocalVariable(name: "f", scope: !9, file: !1, line: 3, type: !14)
46!14 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
47!15 = !DILocation(line: 0, scope: !9)
48!16 = !DILocation(line: 4, column: 3, scope: !9)
49!17 = !DILocation(line: 5, column: 1, scope: !9)
50!18 = !DILocalVariable(name: "g", scope: !9, file: !1, line: 3, type: !14)
51!19 = !{}
52