1 ; RUN: llvm-link %s %p/DbgDeclare2.ll -o %t.bc
2 ; RUN: llvm-dis < %t.bc | FileCheck %s
3 ; Test if metadata in dbg.declare is mapped properly or not.
6 ; CHECK: define i32 @main(i32 %argc, i8** %argv)
7 ; CHECK: call void @llvm.dbg.declare(metadata !{i32* %argc.addr}, metadata !{{[0-9]+}})
8 ; CHECK: call void @llvm.dbg.declare(metadata !{i8*** %argv.addr}, metadata !{{[0-9]+}})
9 ; CHECK: define void @test(i32 %argc, i8** %argv)
10 ; CHECK: call void @llvm.dbg.declare(metadata !{i32* %argc.addr}, metadata !{{[0-9]+}})
11 ; CHECK: call void @llvm.dbg.declare(metadata !{i8*** %argv.addr}, metadata !{{[0-9]+}})
12 ; CHECK: call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !{{[0-9]+}})
14 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
15 target triple = "x86_64-apple-macosx10.9.0"
17 define i32 @main(i32 %argc, i8** %argv) uwtable ssp {
19 %retval = alloca i32, align 4
20 %argc.addr = alloca i32, align 4
21 %argv.addr = alloca i8**, align 8
22 store i32 0, i32* %retval
23 store i32 %argc, i32* %argc.addr, align 4
24 call void @llvm.dbg.declare(metadata !{i32* %argc.addr}, metadata !14), !dbg !15
25 store i8** %argv, i8*** %argv.addr, align 8
26 call void @llvm.dbg.declare(metadata !{i8*** %argv.addr}, metadata !16), !dbg !15
27 %0 = load i32* %argc.addr, align 4, !dbg !17
28 %1 = load i8*** %argv.addr, align 8, !dbg !17
29 call void @test(i32 %0, i8** %1), !dbg !17
33 declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
35 declare void @test(i32, i8**)
38 !llvm.module.flags = !{!21}
40 !0 = metadata !{i32 786449, metadata !20, i32 4, metadata !"clang version 3.3 (trunk 173515)", i1 true, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, null, metadata !""} ; [ DW_TAG_compile_unit ]
41 !1 = metadata !{metadata !2}
42 !2 = metadata !{i32 0}
43 !3 = metadata !{metadata !5}
44 !5 = metadata !{i32 786478, metadata !20, null, metadata !"main", metadata !"main", metadata !"", i32 3, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 (i32, i8**)* @main, null, null, metadata !1, i32 4} ; [ DW_TAG_subprogram ]
45 !6 = metadata !{i32 786473, metadata !20} ; [ DW_TAG_file_type ]
46 !7 = metadata !{i32 786453, i32 0, null, i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !8, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
47 !8 = metadata !{metadata !9, metadata !9, metadata !10}
48 !9 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
49 !10 = metadata !{i32 786447, null, null, null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !11} ; [ DW_TAG_pointer_type ]
50 !11 = metadata !{i32 786447, null, null, null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !12} ; [ DW_TAG_pointer_type ]
51 !12 = metadata !{i32 786470, null, null, null, i32 0, i64 0, i64 0, i64 0, i32 0, metadata !13} ; [ DW_TAG_const_type ]
52 !13 = metadata !{i32 786468, null, null, metadata !"char", i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ]
53 !14 = metadata !{i32 786689, metadata !5, metadata !"argc", metadata !6, i32 16777219, metadata !9, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
54 !15 = metadata !{i32 3, i32 0, metadata !5, null}
55 !16 = metadata !{i32 786689, metadata !5, metadata !"argv", metadata !6, i32 33554435, metadata !10, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
56 !17 = metadata !{i32 5, i32 0, metadata !18, null}
57 !18 = metadata !{i32 786443, metadata !20, metadata !5, i32 4, i32 0, i32 0} ; [ DW_TAG_lexical_block ]
58 !19 = metadata !{i32 6, i32 0, metadata !18, null}
59 !20 = metadata !{metadata !"main.cpp", metadata !"/private/tmp"}
60 !21 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}