OSDN Git Service

Update aosp/master LLVM for rebase to r230699.
[android-x86/external-llvm.git] / test / DebugInfo / X86 / array.ll
1 ; ModuleID = 'array.c'
2 ;
3 ; From (clang -g -c -O1):
4 ;
5 ; void f(int* p) {
6 ;   p[0] = 42;
7 ; }
8 ;
9 ; int main(int argc, char** argv) {
10 ;   int array[4] = { 0, 1, 2, 3 };
11 ;   f(array);
12 ;   return array[0];
13 ; }
14 ;
15 ; RUN: llc -filetype=asm %s -o - | FileCheck %s
16 ; Test that we only emit register-indirect locations for the array array.
17 ; rdar://problem/14874886
18 ;
19 ; CHECK:     ##DEBUG_VALUE: main:array <- [R{{.*}}+0]
20 ; CHECK-NOT: ##DEBUG_VALUE: main:array <- R{{.*}}
21 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
22 target triple = "x86_64-apple-macosx10.9.0"
23
24 @main.array = private unnamed_addr constant [4 x i32] [i32 0, i32 1, i32 2, i32 3], align 16
25
26 ; Function Attrs: nounwind ssp uwtable
27 define void @f(i32* nocapture %p) #0 {
28   tail call void @llvm.dbg.value(metadata i32* %p, i64 0, metadata !11, metadata !{!"0x102"}), !dbg !28
29   store i32 42, i32* %p, align 4, !dbg !29, !tbaa !30
30   ret void, !dbg !34
31 }
32
33 ; Function Attrs: nounwind ssp uwtable
34 define i32 @main(i32 %argc, i8** nocapture readnone %argv) #0 {
35   %array = alloca [4 x i32], align 16
36   tail call void @llvm.dbg.value(metadata i32 %argc, i64 0, metadata !19, metadata !{!"0x102"}), !dbg !35
37   tail call void @llvm.dbg.value(metadata i8** %argv, i64 0, metadata !20, metadata !{!"0x102"}), !dbg !35
38   tail call void @llvm.dbg.value(metadata [4 x i32]* %array, i64 0, metadata !21, metadata !{!"0x102"}), !dbg !36
39   %1 = bitcast [4 x i32]* %array to i8*, !dbg !36
40   call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* bitcast ([4 x i32]* @main.array to i8*), i64 16, i32 16, i1 false), !dbg !36
41   tail call void @llvm.dbg.value(metadata [4 x i32]* %array, i64 0, metadata !21, metadata !{!"0x102"}), !dbg !36
42   %2 = getelementptr inbounds [4 x i32]* %array, i64 0, i64 0, !dbg !37
43   call void @f(i32* %2), !dbg !37
44   tail call void @llvm.dbg.value(metadata [4 x i32]* %array, i64 0, metadata !21, metadata !{!"0x102"}), !dbg !36
45   %3 = load i32* %2, align 16, !dbg !38, !tbaa !30
46   ret i32 %3, !dbg !38
47 }
48
49 ; Function Attrs: nounwind
50 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #1
51
52 ; Function Attrs: nounwind readnone
53 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
54
55 attributes #0 = { nounwind ssp uwtable }
56 attributes #1 = { nounwind }
57 attributes #2 = { nounwind readnone }
58
59 !llvm.dbg.cu = !{!0}
60 !llvm.module.flags = !{!25, !26}
61 !llvm.ident = !{!27}
62
63 !0 = !{!"0x11\0012\00clang version 3.5.0 \001\00\000\00\001", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [/array.c] [DW_LANG_C99]
64 !1 = !{!"array.c", !""}
65 !2 = !{}
66 !3 = !{!4, !12}
67 !4 = !{!"0x2e\00f\00f\00\001\000\001\000\006\00256\001\001", !1, !5, !6, null, void (i32*)* @f, null, null, !10} ; [ DW_TAG_subprogram ] [line 1] [def] [f]
68 !5 = !{!"0x29", !1}          ; [ DW_TAG_file_type ] [/array.c]
69 !6 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
70 !7 = !{null, !8}
71 !8 = !{!"0xf\00\000\0064\0064\000\000", null, null, !9} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from int]
72 !9 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
73 !10 = !{!11}
74 !11 = !{!"0x101\00p\0016777217\000", !4, !5, !8} ; [ DW_TAG_arg_variable ] [p] [line 1]
75 !12 = !{!"0x2e\00main\00main\00\005\000\001\000\006\00256\001\005", !1, !5, !13, null, i32 (i32, i8**)* @main, null, null, !18} ; [ DW_TAG_subprogram ] [line 5] [def] [main]
76 !13 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !14, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
77 !14 = !{!9, !9, !15}
78 !15 = !{!"0xf\00\000\0064\0064\000\000", null, null, !16} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from ]
79 !16 = !{!"0xf\00\000\0064\0064\000\000", null, null, !17} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from char]
80 !17 = !{!"0x24\00char\000\008\008\000\000\006", null, null} ; [ DW_TAG_base_type ] [char] [line 0, size 8, align 8, offset 0, enc DW_ATE_signed_char]
81 !18 = !{!19, !20, !21}
82 !19 = !{!"0x101\00argc\0016777221\000", !12, !5, !9} ; [ DW_TAG_arg_variable ] [argc] [line 5]
83 !20 = !{!"0x101\00argv\0033554437\000", !12, !5, !15} ; [ DW_TAG_arg_variable ] [argv] [line 5]
84 !21 = !{!"0x100\00array\006\000", !12, !5, !22} ; [ DW_TAG_auto_variable ] [array] [line 6]
85 !22 = !{!"0x1\00\000\00128\0032\000\000", null, null, !9, !23, i32 0, null, null, null} ; [ DW_TAG_array_type ] [line 0, size 128, align 32, offset 0] [from int]
86 !23 = !{!24}
87 !24 = !{!"0x21\000\004"}        ; [ DW_TAG_subrange_type ] [0, 3]
88 !25 = !{i32 2, !"Dwarf Version", i32 2}
89 !26 = !{i32 1, !"Debug Info Version", i32 2}
90 !27 = !{!"clang version 3.5.0 "}
91 !28 = !MDLocation(line: 1, scope: !4)
92 !29 = !MDLocation(line: 2, scope: !4)
93 !30 = !{!31, !31, i64 0}
94 !31 = !{!"int", !32, i64 0}
95 !32 = !{!"omnipotent char", !33, i64 0}
96 !33 = !{!"Simple C/C++ TBAA"}
97 !34 = !MDLocation(line: 3, scope: !4)
98 !35 = !MDLocation(line: 5, scope: !12)
99 !36 = !MDLocation(line: 6, scope: !12)
100 !37 = !MDLocation(line: 7, scope: !12)
101 !38 = !MDLocation(line: 8, scope: !12)