xref: /llvm-project/llvm/test/tools/llvm-reduce/remove-dimetadata.ll (revision fe50eac85c06b1f97fba4c0540cea84f4b9bac8d)
1; Test that llvm-reduce can remove uninteresting DI metadata from an IR file.
2;
3; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=di-metadata --test=FileCheck --test-arg=--check-prefix=CHECK-INTERESTINGNESS --test-arg=%s --test-arg=--input-file %s -o %t
4; RUN: FileCheck <%t %s
5
6@global = global i32 0
7
8define void @main() !dbg !5 {
9   ret void
10}
11
12!llvm.module.flags = !{!0}
13!llvm.dbg.cu = !{!4}
14
15!0 = !{i32 2, !"Debug Info Version", i32 3}
16!1 = !DIFile(filename: "test.c", directory: "test")
17!2 = !{!10}
18; CHECK: [[EMPTY:![0-9]+]] = !{}
19!4 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !9)
20!5 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 498, type: !6, scopeLine: 0, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !4, retainedNodes: !2)
21!6 = !DISubroutineType(types: !7)
22; CHECK: !DISubroutineType(types: [[EMPTY]])
23!7 = !{!13}
24!8 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !9)
25!9 = !{}
26!10 = !DILocalVariable(name: "one", scope: !14, file: !1, line: 0, type: !15)
27!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
28!14 = distinct !DILexicalBlock(scope: !5, file: !1, line: 3)
29!15 = !DICompositeType(tag: DW_TAG_structure_type, name: "test", file: !1, size: 64, align: 32, flags: DIFlagPublic, elements: !16)
30!16 = !{!17, !18}
31; CHECK: elements: [[EL:![0-9]+]])
32; CHECK: [[EL]] = !{!{{[0-9]+}}}
33; CHECK-INTERESTINGNESS: interesting
34!17 = !DIDerivedType(tag: DW_TAG_member, name: "interesting", scope: !14, file: !1, baseType: !13, size: 32, align: 32, flags: DIFlagPublic)
35!18 = !DIDerivedType(tag: DW_TAG_member, name: "uninteresting", scope: !14, file: !1, baseType: !13, size: 32, align: 32, offset: 32, flags: DIFlagPublic)
36