[opaque pointer type] Add textual IR support for explicit type parameter to load...
[oota-llvm.git] / test / Transforms / GlobalOpt / 2009-03-05-dbg.ll
1 ; REQUIRES: asserts
2 ; RUN: opt < %s -globalopt -stats -disable-output 2>&1 | grep "1 globalopt - Number of global vars shrunk to booleans"
3
4 @Stop = internal global i32 0                     ; <i32*> [#uses=3]
5
6 define i32 @foo(i32 %i) nounwind ssp {
7 entry:
8   %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
9   call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !3, metadata !{})
10   %0 = icmp eq i32 %i, 1, !dbg !7                 ; <i1> [#uses=1]
11   br i1 %0, label %bb, label %bb1, !dbg !7
12
13 bb:                                               ; preds = %entry
14   store i32 0, i32* @Stop, align 4, !dbg !9
15   %1 = mul nsw i32 %i, 42, !dbg !10               ; <i32> [#uses=1]
16   call void @llvm.dbg.value(metadata i32 %1, i64 0, metadata !3, metadata !{}), !dbg !10
17   br label %bb2, !dbg !10
18
19 bb1:                                              ; preds = %entry
20   store i32 1, i32* @Stop, align 4, !dbg !11
21   br label %bb2, !dbg !11
22
23 bb2:                                              ; preds = %bb1, %bb
24   %i_addr.0 = phi i32 [ %1, %bb ], [ %i, %bb1 ]   ; <i32> [#uses=1]
25   br label %return, !dbg !12
26
27 return:                                           ; preds = %bb2
28   ret i32 %i_addr.0, !dbg !12
29 }
30
31 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
32
33 define i32 @bar() nounwind ssp {
34 entry:
35   %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
36   %0 = load i32, i32* @Stop, align 4, !dbg !13         ; <i32> [#uses=1]
37   %1 = icmp eq i32 %0, 1, !dbg !13                ; <i1> [#uses=1]
38   br i1 %1, label %bb, label %bb1, !dbg !13
39
40 bb:                                               ; preds = %entry
41   br label %bb2, !dbg !18
42
43 bb1:                                              ; preds = %entry
44   br label %bb2, !dbg !19
45
46 bb2:                                              ; preds = %bb1, %bb
47   %.0 = phi i32 [ 0, %bb ], [ 1, %bb1 ]           ; <i32> [#uses=1]
48   br label %return, !dbg !19
49
50 return:                                           ; preds = %bb2
51   ret i32 %.0, !dbg !19
52 }
53
54 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
55
56 !llvm.dbg.gv = !{!0}
57
58 !0 = !{!"0x34\00Stop\00Stop\00\002\001\001", !1, !1, !2, i32* @Stop} ; [ DW_TAG_variable ]
59 !1 = !{!"0x11\001\004.2.1 (Based on Apple Inc. build 5658) (LLVM build)\001\00\000\00\000", !20, !21, !21, null, null, null} ; [ DW_TAG_compile_unit ]
60 !2 = !{!"0x24\00int\000\0032\0032\000\000\005", null, !1} ; [ DW_TAG_base_type ]
61 !3 = !{!"0x101\00i\004\000", !4, !1, !2} ; [ DW_TAG_arg_variable ]
62 !4 = !{!"0x2e\00foo\00foo\00foo\004\000\001\000\006\000\000\000", i32 0, !1, !5, null, null, null, null, null} ; [ DW_TAG_subprogram ]
63 !5 = !{!"0x15\00\000\000\000\000\000\000", !1, null, null, !6, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
64 !6 = !{!2, !2}
65 !7 = !MDLocation(line: 5, scope: !8)
66 !8 = !{!"0xb\000\000\000", !20, !4} ; [ DW_TAG_lexical_block ]
67 !9 = !MDLocation(line: 6, scope: !8)
68 !10 = !MDLocation(line: 7, scope: !8)
69 !11 = !MDLocation(line: 9, scope: !8)
70 !12 = !MDLocation(line: 11, scope: !8)
71 !13 = !MDLocation(line: 14, scope: !14)
72 !14 = !{!"0xb\000\000\000", !20, !15} ; [ DW_TAG_lexical_block ]
73 !15 = !{!"0x2e\00bar\00bar\00bar\0013\000\001\000\006\000\000\000", i32 0, !1, !16, null, null, null, null, null} ; [ DW_TAG_subprogram ]
74 !16 = !{!"0x15\00\000\000\000\000\000\000", !1, null, null, !17, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
75 !17 = !{!2}
76 !18 = !MDLocation(line: 15, scope: !14)
77 !19 = !MDLocation(line: 16, scope: !14)
78 !20 = !{!"g.c", !"/tmp"}
79 !21 = !{i32 0}