blob: bad64d8735342aacbe742213fae26448eee4f572 [file] [log] [blame]
Devang Patel36da24b2010-06-04 22:27:30 +00001; RUN: opt -mem2reg < %s | llvm-dis | grep ".dbg " | count 7
Devang Patel7a9dedf2010-05-27 20:25:04 +00002
Adrian Prantl87b7eb92014-10-01 18:55:02 +00003declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
Devang Patel7a9dedf2010-05-27 20:25:04 +00004
5declare void @foo(i32, i64, i8*)
6
7define void @baz(i32 %a) nounwind ssp {
8entry:
9 %x_addr.i = alloca i32 ; <i32*> [#uses=2]
10 %y_addr.i = alloca i64 ; <i64*> [#uses=2]
11 %z_addr.i = alloca i8* ; <i8**> [#uses=2]
12 %a_addr = alloca i32 ; <i32*> [#uses=2]
13 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000014 call void @llvm.dbg.declare(metadata i32* %a_addr, metadata !0, metadata !{}), !dbg !7
Devang Patel7a9dedf2010-05-27 20:25:04 +000015 store i32 %a, i32* %a_addr
David Blaikiea79ac142015-02-27 21:17:42 +000016 %0 = load i32, i32* %a_addr, align 4, !dbg !8 ; <i32> [#uses=1]
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000017 call void @llvm.dbg.declare(metadata i32* %x_addr.i, metadata !9, metadata !{}) nounwind, !dbg !15
Devang Patel7a9dedf2010-05-27 20:25:04 +000018 store i32 %0, i32* %x_addr.i
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000019 call void @llvm.dbg.declare(metadata i64* %y_addr.i, metadata !16, metadata !{}) nounwind, !dbg !15
Devang Patel7a9dedf2010-05-27 20:25:04 +000020 store i64 55, i64* %y_addr.i
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000021 call void @llvm.dbg.declare(metadata i8** %z_addr.i, metadata !17, metadata !{}) nounwind, !dbg !15
Devang Patel7a9dedf2010-05-27 20:25:04 +000022 store i8* bitcast (void (i32)* @baz to i8*), i8** %z_addr.i
David Blaikiea79ac142015-02-27 21:17:42 +000023 %1 = load i32, i32* %x_addr.i, align 4, !dbg !18 ; <i32> [#uses=1]
24 %2 = load i64, i64* %y_addr.i, align 8, !dbg !18 ; <i64> [#uses=1]
25 %3 = load i8*, i8** %z_addr.i, align 8, !dbg !18 ; <i8*> [#uses=1]
Devang Patel7a9dedf2010-05-27 20:25:04 +000026 call void @foo(i32 %1, i64 %2, i8* %3) nounwind, !dbg !18
27 br label %return, !dbg !19
28
29return: ; preds = %entry
30 ret void, !dbg !19
31}
32
Manman Rene9a52e12013-07-29 18:12:58 +000033!llvm.dbg.cu = !{!3}
Manman Ren409558f2013-11-22 21:49:45 +000034!llvm.module.flags = !{!22}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000035!0 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "a", line: 8, arg: 0, scope: !1, file: !2, type: !6)
36!1 = !MDSubprogram(name: "baz", linkageName: "baz", line: 8, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 8, file: !20, scope: !2, type: !4, function: void (i32)* @baz)
37!2 = !MDFile(filename: "bar.c", directory: "/tmp/")
38!3 = !MDCompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true, emissionKind: 0, file: !20, enums: !21, retainedTypes: !21)
39!4 = !MDSubroutineType(types: !5)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000040!5 = !{null, !6}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000041!6 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +000042!7 = !MDLocation(line: 8, scope: !1)
43!8 = !MDLocation(line: 9, scope: !1)
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000044!9 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 4, arg: 0, scope: !10, file: !2, type: !6)
45!10 = !MDSubprogram(name: "bar", linkageName: "bar", line: 4, isLocal: true, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 4, file: !20, scope: !2, type: !11)
46!11 = !MDSubroutineType(types: !12)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000047!12 = !{null, !6, !13, !14}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000048!13 = !MDBasicType(tag: DW_TAG_base_type, name: "long int", size: 64, align: 64, encoding: DW_ATE_signed)
49!14 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !20, scope: !2, baseType: null)
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +000050!15 = !MDLocation(line: 4, scope: !10, inlinedAt: !8)
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000051!16 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "y", line: 4, arg: 0, scope: !10, file: !2, type: !13)
52!17 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "z", line: 4, arg: 0, scope: !10, file: !2, type: !14)
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +000053!18 = !MDLocation(line: 5, scope: !10, inlinedAt: !8)
54!19 = !MDLocation(line: 10, scope: !1)
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000055!20 = !MDFile(filename: "bar.c", directory: "/tmp/")
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000056!21 = !{i32 0}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000057!22 = !{i32 1, !"Debug Info Version", i32 3}