xref: /llvm-project/llvm/test/Transforms/Util/strip-nonlinetable-debuginfo-localvars.ll (revision 7fc25928233c133a4af1dadf0e060fb5d42ebd4e)
1; RUN: opt -S -passes=strip-nonlinetable-debuginfo %s -o - | FileCheck %s
2; RUN: opt -S -passes=strip-nonlinetable-debuginfo %s -o - --try-experimental-debuginfo-iterators | FileCheck %s
3; CHECK: define void @f() !dbg ![[F:[0-9]+]]
4define void @f() !dbg !4 {
5entry:
6  %i = alloca i32, align 4
7  ; CHECK-NOT: llvm.dbg.{{declare|value}}
8  call void @llvm.dbg.declare(metadata ptr %i, metadata !11, metadata !13), !dbg !14
9  store i32 42, ptr %i, align 4, !dbg !14
10  call void @llvm.dbg.value(metadata i32 0, metadata !16, metadata !13), !dbg !15
11  ret void, !dbg !15
12}
13
14; Function Attrs: nounwind readnone
15declare void @llvm.dbg.declare(metadata, metadata, metadata)
16declare void @llvm.dbg.value(metadata, metadata, metadata)
17
18!llvm.dbg.cu = !{!0}
19!llvm.module.flags = !{!7, !8, !9}
20!llvm.ident = !{!10}
21
22!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "LLVM", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2)
23!1 = !DIFile(filename: "f.c", directory: "/")
24!2 = !{}
25; CHECK: ![[F]] = distinct !DISubprogram(name: "f"
26; CHECK-NOT: retainedNodes:
27; CHECK-NOT: distinct !DISubprogram(name: "f"
28; CHECK-NOT: DILocalVariable
29!4 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, unit: !0, retainedNodes: !2)
30!5 = !DISubroutineType(types: !6)
31!6 = !{null}
32!7 = !{i32 2, !"Dwarf Version", i32 2}
33!8 = !{i32 2, !"Debug Info Version", i32 3}
34!9 = !{i32 1, !"PIC Level", i32 2}
35!10 = !{!"LLVM"}
36!11 = !DILocalVariable(name: "i", scope: !4, file: !1, line: 1, type: !12)
37!12 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
38!13 = !DIExpression()
39!14 = !DILocation(line: 1, column: 16, scope: !4)
40!15 = !DILocation(line: 1, column: 24, scope: !4)
41!16 = !DILocalVariable(name: "j", scope: !4, file: !1, line: 1, type: !12)
42