1 ; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t --try-experimental-debuginfo-iterators
2 ; RUN: FileCheck --check-prefixes=CHECK-FINAL --input-file=%t %s --implicit-check-not=dbg.value
4 ; Test that we can, in RemoveDIs mode / DPValues mode (where variable location
5 ; information isn't an instruction), remove one variable location assignment
8 ; CHECK-INTERESTINGNESS: call void @llvm.dbg.value(metadata i32 %added,
10 ; CHECK-FINAL: declare void @llvm.dbg.value(metadata,
11 ; CHECK-FINAL: %added = add
12 ; CHECK-FINAL-NEXT: call void @llvm.dbg.value(metadata i32 %added,
14 declare void @llvm.dbg.value(metadata, metadata, metadata)
16 define i32 @main() !dbg !7 {
18 %uninteresting1 = alloca i32, align 4
19 %interesting = alloca i32, align 4
20 %uninteresting2 = alloca i32, align 4
21 store i32 0, ptr %uninteresting1, align 4
22 store i32 0, ptr %interesting, align 4
23 %0 = load i32, ptr %interesting, align 4
24 %added = add nsw i32 %0, 1
25 tail call void @llvm.dbg.value(metadata i32 %added, metadata !13, metadata !DIExpression()), !dbg !14
26 store i32 %added, ptr %interesting, align 4
27 %alsoloaded = load i32, ptr %interesting, align 4
28 tail call void @llvm.dbg.value(metadata i32 %alsoloaded, metadata !13, metadata !DIExpression()), !dbg !14
29 store i32 %alsoloaded, ptr %uninteresting2, align 4
34 !llvm.module.flags = !{!2, !3, !4, !5, !6}
36 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 14.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
37 !1 = !DIFile(filename: "/tmp/a.c", directory: "/")
38 !2 = !{i32 7, !"Dwarf Version", i32 4}
39 !3 = !{i32 2, !"Debug Info Version", i32 3}
40 !4 = !{i32 1, !"wchar_size", i32 4}
41 !5 = !{i32 7, !"uwtable", i32 1}
42 !6 = !{i32 7, !"frame-pointer", i32 2}
43 !7 = distinct !DISubprogram(name: "main", scope: !8, file: !8, line: 1, type: !9, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !12)
44 !8 = !DIFile(filename: "/tmp/a.c", directory: "")
45 !9 = !DISubroutineType(types: !10)
47 !11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
49 !13 = !DILocalVariable(name: "a", scope: !7, file: !8, line: 2, type: !11)
50 !14 = !DILocation(line: 2, column: 7, scope: !7)