]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - opencl/llvm.git/blob - test/CodeGen/X86/2010-08-04-StackVariable.ll
IR: Move MDLocation into place
[opencl/llvm.git] / test / CodeGen / X86 / 2010-08-04-StackVariable.ll
1 ; RUN: llc -O0 -mtriple=x86_64-apple-darwin < %s | grep DW_OP_breg7
2 ; Use DW_OP_breg7 in variable's location expression if the variable is in a stack slot.
4 %struct.SVal = type { i8*, i32 }
6 define i32 @_Z3fooi4SVal(i32 %i, %struct.SVal* noalias %location) 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 !23, metadata !{!"0x102"}), !dbg !24
10   call void @llvm.dbg.value(metadata %struct.SVal* %location, i64 0, metadata !25, metadata !{!"0x102"}), !dbg !24
11   %0 = icmp ne i32 %i, 0, !dbg !27                ; <i1> [#uses=1]
12   br i1 %0, label %bb, label %bb1, !dbg !27
14 bb:                                               ; preds = %entry
15   %1 = getelementptr inbounds %struct.SVal* %location, i32 0, i32 1, !dbg !29 ; <i32*> [#uses=1]
16   %2 = load i32* %1, align 8, !dbg !29            ; <i32> [#uses=1]
17   %3 = add i32 %2, %i, !dbg !29                   ; <i32> [#uses=1]
18   br label %bb2, !dbg !29
20 bb1:                                              ; preds = %entry
21   %4 = getelementptr inbounds %struct.SVal* %location, i32 0, i32 1, !dbg !30 ; <i32*> [#uses=1]
22   %5 = load i32* %4, align 8, !dbg !30            ; <i32> [#uses=1]
23   %6 = sub i32 %5, 1, !dbg !30                    ; <i32> [#uses=1]
24   br label %bb2, !dbg !30
26 bb2:                                              ; preds = %bb1, %bb
27   %.0 = phi i32 [ %3, %bb ], [ %6, %bb1 ]         ; <i32> [#uses=1]
28   br label %return, !dbg !29
30 return:                                           ; preds = %bb2
31   ret i32 %.0, !dbg !29
32 }
34 define linkonce_odr void @_ZN4SValC1Ev(%struct.SVal* %this) nounwind ssp align 2 {
35 entry:
36   %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
37   call void @llvm.dbg.value(metadata %struct.SVal* %this, i64 0, metadata !31, metadata !{!"0x102"}), !dbg !34
38   %0 = getelementptr inbounds %struct.SVal* %this, i32 0, i32 0, !dbg !34 ; <i8**> [#uses=1]
39   store i8* null, i8** %0, align 8, !dbg !34
40   %1 = getelementptr inbounds %struct.SVal* %this, i32 0, i32 1, !dbg !34 ; <i32*> [#uses=1]
41   store i32 0, i32* %1, align 8, !dbg !34
42   br label %return, !dbg !34
44 return:                                           ; preds = %entry
45   ret void, !dbg !35
46 }
48 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
50 define i32 @main() nounwind ssp {
51 entry:
52   %0 = alloca %struct.SVal                        ; <%struct.SVal*> [#uses=3]
53   %v = alloca %struct.SVal                        ; <%struct.SVal*> [#uses=4]
54   %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
55   call void @llvm.dbg.declare(metadata %struct.SVal* %v, metadata !38, metadata !{!"0x102"}), !dbg !41
56   call void @_ZN4SValC1Ev(%struct.SVal* %v) nounwind, !dbg !41
57   %1 = getelementptr inbounds %struct.SVal* %v, i32 0, i32 1, !dbg !42 ; <i32*> [#uses=1]
58   store i32 1, i32* %1, align 8, !dbg !42
59   %2 = getelementptr inbounds %struct.SVal* %0, i32 0, i32 0, !dbg !43 ; <i8**> [#uses=1]
60   %3 = getelementptr inbounds %struct.SVal* %v, i32 0, i32 0, !dbg !43 ; <i8**> [#uses=1]
61   %4 = load i8** %3, align 8, !dbg !43            ; <i8*> [#uses=1]
62   store i8* %4, i8** %2, align 8, !dbg !43
63   %5 = getelementptr inbounds %struct.SVal* %0, i32 0, i32 1, !dbg !43 ; <i32*> [#uses=1]
64   %6 = getelementptr inbounds %struct.SVal* %v, i32 0, i32 1, !dbg !43 ; <i32*> [#uses=1]
65   %7 = load i32* %6, align 8, !dbg !43            ; <i32> [#uses=1]
66   store i32 %7, i32* %5, align 8, !dbg !43
67   %8 = call i32 @_Z3fooi4SVal(i32 2, %struct.SVal* noalias %0) nounwind, !dbg !43 ; <i32> [#uses=0]
68   call void @llvm.dbg.value(metadata i32 %8, i64 0, metadata !44, metadata !{!"0x102"}), !dbg !43
69   br label %return, !dbg !45
71 return:                                           ; preds = %entry
72   ret i32 0, !dbg !45
73 }
75 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
77 !llvm.dbg.cu = !{!3}
78 !llvm.module.flags = !{!49}
79 !46 = !{!16, !17, !20}
81 !0 = !{!"0x2e\00SVal\00SVal\00\0011\000\000\000\006\000\000\0011", !47, !1, !14, null, null, null, null, null} ; [ DW_TAG_subprogram ]
82 !1 = !{!"0x13\00SVal\001\00128\0064\000\000\000", !47, !2, null, !4, null, null, null} ; [ DW_TAG_structure_type ] [SVal] [line 1, size 128, align 64, offset 0] [def] [from ]
83 !2 = !{!"0x29", !47} ; [ DW_TAG_file_type ]
84 !3 = !{!"0x11\004\004.2.1 (Based on Apple Inc. build 5658) (LLVM build)\000\00\000\00\001", !47, !48, !48, !46, null,  null} ; [ DW_TAG_compile_unit ]
85 !4 = !{!5, !7, !0, !9}
86 !5 = !{!"0xd\00Data\007\0064\0064\000\000", !47, !1, !6} ; [ DW_TAG_member ]
87 !6 = !{!"0xf\00\000\0064\0064\000\000", !47, !2, null} ; [ DW_TAG_pointer_type ]
88 !7 = !{!"0xd\00Kind\008\0032\0032\0064\000", !47, !1, !8} ; [ DW_TAG_member ]
89 !8 = !{!"0x24\00unsigned int\000\0032\0032\000\000\007", !47, !2} ; [ DW_TAG_base_type ]
90 !9 = !{!"0x2e\00~SVal\00~SVal\00\0012\000\000\000\006\000\000\0012", !47, !1, !10, null, null, null, null, null} ; [ DW_TAG_subprogram ]
91 !10 = !{!"0x15\00\000\000\000\000\000\000", !47, !2, null, !11, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
92 !11 = !{null, !12, !13}
93 !12 = !{!"0xf\00\000\0064\0064\000\0064", !47, !2, !1} ; [ DW_TAG_pointer_type ]
94 !13 = !{!"0x24\00int\000\0032\0032\000\000\005", !47, !2} ; [ DW_TAG_base_type ]
95 !14 = !{!"0x15\00\000\000\000\000\000\000", !47, !2, null, !15, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
96 !15 = !{null, !12}
97 !16 = !{!"0x2e\00SVal\00SVal\00_ZN4SValC1Ev\0011\000\001\000\006\000\000\0011", !47, !1, !14, null, void (%struct.SVal*)* @_ZN4SValC1Ev, null, null, null} ; [ DW_TAG_subprogram ]
98 !17 = !{!"0x2e\00foo\00foo\00_Z3fooi4SVal\0016\000\001\000\006\000\000\0016", !47, !2, !18, null, i32 (i32, %struct.SVal*)* @_Z3fooi4SVal, null, null, null} ; [ DW_TAG_subprogram ]
99 !18 = !{!"0x15\00\000\000\000\000\000\000", !47, !2, null, !19, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
100 !19 = !{!13, !13, !1}
101 !20 = !{!"0x2e\00main\00main\00main\0023\000\001\000\006\000\000\0023", !47, !2, !21, null, i32 ()* @main, null, null, null} ; [ DW_TAG_subprogram ]
102 !21 = !{!"0x15\00\000\000\000\000\000\000", !47, !2, null, !22, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
103 !22 = !{!13}
104 !23 = !{!"0x101\00i\0016\000", !17, !2, !13} ; [ DW_TAG_arg_variable ]
105 !24 = !MDLocation(line: 16, scope: !17)
106 !25 = !{!"0x101\00location\0016\000", !17, !2, !26} ; [ DW_TAG_arg_variable ]
107 !26 = !{!"0x10\00SVal\000\0064\0064\000\000", !47, !2, !1} ; [ DW_TAG_reference_type ]
108 !27 = !MDLocation(line: 17, scope: !28)
109 !28 = !{!"0xb\0016\000\002", !47, !17} ; [ DW_TAG_lexical_block ]
110 !29 = !MDLocation(line: 18, scope: !28)
111 !30 = !MDLocation(line: 20, scope: !28)
112 !31 = !{!"0x101\00this\0011\000", !16, !2, !32} ; [ DW_TAG_arg_variable ]
113 !32 = !{!"0x26\00\000\0064\0064\000\0064", !47, !2, !33} ; [ DW_TAG_const_type ]
114 !33 = !{!"0xf\00\000\0064\0064\000\000", !47, !2, !1} ; [ DW_TAG_pointer_type ]
115 !34 = !MDLocation(line: 11, scope: !16)
116 !35 = !MDLocation(line: 11, scope: !36)
117 !36 = !{!"0xb\0011\000\001", !47, !37} ; [ DW_TAG_lexical_block ]
118 !37 = !{!"0xb\0011\000\000", !47, !16} ; [ DW_TAG_lexical_block ]
119 !38 = !{!"0x100\00v\0024\000", !39, !2, !1} ; [ DW_TAG_auto_variable ]
120 !39 = !{!"0xb\0023\000\004", !47, !40} ; [ DW_TAG_lexical_block ]
121 !40 = !{!"0xb\0023\000\003", !47, !20} ; [ DW_TAG_lexical_block ]
122 !41 = !MDLocation(line: 24, scope: !39)
123 !42 = !MDLocation(line: 25, scope: !39)
124 !43 = !MDLocation(line: 26, scope: !39)
125 !44 = !{!"0x100\00k\0026\000", !39, !2, !13} ; [ DW_TAG_auto_variable ]
126 !45 = !MDLocation(line: 27, scope: !39)
127 !47 = !{!"small.cc", !"/Users/manav/R8248330"}
128 !48 = !{i32 0}
129 !49 = !{i32 1, !"Debug Info Version", i32 2}