1 ; RUN: opt -S -add-discriminators < %s | FileCheck %s
2 ; RUN: opt -S -passes=add-discriminators < %s | FileCheck %s
4 declare void @llvm.dbg.declare(metadata, metadata, metadata)
6 ; This checks whether the add-discriminators pass producess valid metadata on
7 ; llvm.dbg.declare instructions
9 ; CHECK-LABEL: @test_valid_metadata
10 define void @test_valid_metadata() {
12 call void @llvm.dbg.declare(metadata i8* %a, metadata !2, metadata !5), !dbg !6
14 call void @llvm.dbg.declare(metadata i8* %b, metadata !9, metadata !5), !dbg !11
18 !llvm.module.flags = !{!0, !1}
21 !0 = !{i32 2, !"Dwarf Version", i32 4}
22 !1 = !{i32 2, !"Debug Info Version", i32 3}
23 !2 = !DILocalVariable(scope: !3)
24 !3 = distinct !DISubprogram(scope: null, file: !4, isLocal: false, isDefinition: true, isOptimized: false, unit: !12)
25 !4 = !DIFile(filename: "a.cpp", directory: "/tmp")
27 !6 = !DILocation(line: 0, scope: !3, inlinedAt: !7)
28 !7 = distinct !DILocation(line: 0, scope: !8)
29 !8 = distinct !DISubprogram(linkageName: "test_valid_metadata", scope: null, isLocal: false, isDefinition: true, isOptimized: false, unit: !12)
30 !9 = !DILocalVariable(scope: !10)
31 !10 = distinct !DISubprogram(scope: null, file: !4, isLocal: false, isDefinition: true, isOptimized: false, unit: !12)
32 !11 = !DILocation(line: 0, scope: !10)
33 !12 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 ", isOptimized: false, emissionKind: FullDebug, file: !4)