1 ; RUN: opt < %s -print-dbginfo -disable-output |& FileCheck %s
2 ; grep {%b is variable b of type x declared at x.c:7} %t1
3 ; grep {%2 is variable b of type x declared at x.c:7} %t1
4 ; grep {@c.1442 is variable c of type int declared at x.c:4} %t1
6 %struct.foo = type { i32 }
8 @main.c = internal global i32 5 ; <i32*> [#uses=1]
10 define i32 @main() nounwind {
12 %retval = alloca i32 ; <i32*> [#uses=3]
13 %b = alloca %struct.foo, align 4 ; <%struct.foo*> [#uses=2]
14 ; CHECK:; %b is variable b of type foo declared at x.c:7
15 %a = alloca [4 x i32], align 4 ; <[4 x i32]*> [#uses=1]
16 ; CHECK:; %a is variable a of type declared at x.c:8
17 call void @llvm.dbg.func.start(metadata !3)
18 store i32 0, i32* %retval
19 call void @llvm.dbg.stoppoint(i32 6, i32 3, metadata !1)
20 call void @llvm.dbg.stoppoint(i32 7, i32 3, metadata !1)
21 %0 = bitcast %struct.foo* %b to { }* ; <{ }*> [#uses=1]
22 call void @llvm.dbg.declare(metadata !{%struct.foo* %b}, metadata !4)
23 ; CHECK:; %0 is variable b of type foo declared at x.c:7
24 call void @llvm.dbg.stoppoint(i32 8, i32 3, metadata !1)
25 %1 = bitcast [4 x i32]* %a to { }* ; <{ }*> [#uses=1]
26 call void @llvm.dbg.declare(metadata !{[4 x i32]* %a}, metadata !8)
27 ; CHECK:; %1 is variable a of type declared at x.c:8
28 call void @llvm.dbg.stoppoint(i32 9, i32 3, metadata !1)
29 %tmp = getelementptr inbounds %struct.foo* %b, i32 0, i32 0 ; <i32*> [#uses=1]
30 ; CHECK:; %tmp is variable b of type foo declared at x.c:7
31 store i32 5, i32* %tmp
32 call void @llvm.dbg.stoppoint(i32 10, i32 3, metadata !1)
33 %tmp1 = load i32* @main.c ; <i32> [#uses=1]
34 ; CHECK:; @main.c is variable c of type int declared at x.c:6
35 store i32 %tmp1, i32* %retval
38 ; <label>:2 ; preds = %entry
39 call void @llvm.dbg.stoppoint(i32 11, i32 1, metadata !1)
40 call void @llvm.dbg.region.end(metadata !3)
41 %3 = load i32* %retval ; <i32> [#uses=1]
45 declare void @llvm.dbg.func.start(metadata) nounwind readnone
47 declare void @llvm.dbg.stoppoint(i32, i32, metadata) nounwind readnone
49 declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
51 declare void @llvm.dbg.region.end(metadata) nounwind readnone
55 !0 = metadata !{i32 458804, i32 0, metadata !1, metadata !"c", metadata !"c", metadata !"", metadata !1, i32 6, metadata !2, i1 true, i1 true, i32* @main.c}
56 !1 = metadata !{i32 458769, i32 0, i32 12, metadata !"x.c", metadata !"/home/edwin/llvm-git/llvm/test/DebugInfo", metadata !"clang 1.0", i1 true, i1 false, metadata !"", i32 0}
57 !2 = metadata !{i32 458788, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5}
58 !3 = metadata !{i32 458798, i32 0, metadata !1, metadata !"main", metadata !"main", metadata !"main", metadata !1, i32 5, metadata !2, i1 false, i1 true}
59 !4 = metadata !{i32 459008, metadata !3, metadata !"b", metadata !1, i32 7, metadata !5}
60 !5 = metadata !{i32 458771, metadata !1, metadata !"foo", metadata !1, i32 1, i64 32, i64 32, i64 0, i32 0, null, metadata !6, i32 0}
61 !6 = metadata !{metadata !7}
62 !7 = metadata !{i32 458765, metadata !1, metadata !"a", metadata !1, i32 2, i64 32, i64 32, i64 0, i32 0, metadata !2}
63 !8 = metadata !{i32 459008, metadata !3, metadata !"a", metadata !1, i32 8, metadata !9}
64 !9 = metadata !{i32 458753, metadata !1, metadata !"", null, i32 0, i64 128, i64 32, i64 0, i32 0, metadata !2, metadata !10, i32 0}
65 !10 = metadata !{metadata !11}
66 !11 = metadata !{i32 458785, i64 0, i64 3}