[InstCombine] Signed saturation patterns
[llvm-complete.git] / test / CodeGen / BPF / BTF / static-var-zerolen-array.ll
blob93f5da342aa4732dfa38581112bca2c1e54d05d3
1 ; RUN: llc -march=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
2 ; RUN: llc -march=bpfeb -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
4 ; Source code:
5 ;   struct t {
6 ;     int a;
7 ;     int b;
8 ;     char c[];
9 ;   };
10 ;   static volatile struct t sv = {3, 4, "abcdefghi"};
11 ;   int test() { return sv.a; }
12 ; Compilation flag:
13 ;   clang -target bpf -O2 -g -S -emit-llvm test.c
15 @sv = internal global { i32, i32, [10 x i8] } { i32 3, i32 4, [10 x i8] c"abcdefghi\00" }, align 4, !dbg !0
17 ; Function Attrs: norecurse nounwind
18 define dso_local i32 @test() local_unnamed_addr #0 !dbg !21 {
19   %1 = load volatile i32, i32* getelementptr inbounds ({ i32, i32, [10 x i8] }, { i32, i32, [10 x i8] }* @sv, i64 0, i32 0), align 4, !dbg !24, !tbaa !25
20   ret i32 %1, !dbg !29
23 ; CHECK:             .section        .BTF,"",@progbits
24 ; CHECK-NEXT:        .short  60319                   # 0xeb9f
25 ; CHECK-NEXT:        .byte   1
26 ; CHECK-NEXT:        .byte   0
27 ; CHECK-NEXT:        .long   24
28 ; CHECK-NEXT:        .long   0
29 ; CHECK-NEXT:        .long   196
30 ; CHECK-NEXT:        .long   196
31 ; CHECK-NEXT:        .long   95
32 ; CHECK-NEXT:        .long   0                       # BTF_KIND_FUNC_PROTO(id = 1)
33 ; CHECK-NEXT:        .long   218103808               # 0xd000000
34 ; CHECK-NEXT:        .long   2
35 ; CHECK-NEXT:        .long   1                       # BTF_KIND_INT(id = 2)
36 ; CHECK-NEXT:        .long   16777216                # 0x1000000
37 ; CHECK-NEXT:        .long   4
38 ; CHECK-NEXT:        .long   16777248                # 0x1000020
39 ; CHECK-NEXT:        .long   5                       # BTF_KIND_FUNC(id = 3)
40 ; CHECK-NEXT:        .long   201326592               # 0xc000000
41 ; CHECK-NEXT:        .long   1
42 ; CHECK-NEXT:        .long   0                       # BTF_KIND_VOLATILE(id = 4)
43 ; CHECK-NEXT:        .long   150994944               # 0x9000000
44 ; CHECK-NEXT:        .long   5
45 ; CHECK-NEXT:        .long   53                      # BTF_KIND_STRUCT(id = 5)
46 ; CHECK-NEXT:        .long   67108867                # 0x4000003
47 ; CHECK-NEXT:        .long   8
48 ; CHECK-NEXT:        .long   55
49 ; CHECK-NEXT:        .long   2
50 ; CHECK-NEXT:        .long   0                       # 0x0
51 ; CHECK-NEXT:        .long   57
52 ; CHECK-NEXT:        .long   2
53 ; CHECK-NEXT:        .long   32                      # 0x20
54 ; CHECK-NEXT:        .long   59
55 ; CHECK-NEXT:        .long   7
56 ; CHECK-NEXT:        .long   64                      # 0x40
57 ; CHECK-NEXT:        .long   61                      # BTF_KIND_INT(id = 6)
58 ; CHECK-NEXT:        .long   16777216                # 0x1000000
59 ; CHECK-NEXT:        .long   1
60 ; CHECK-NEXT:        .long   16777224                # 0x1000008
61 ; CHECK-NEXT:        .long   0                       # BTF_KIND_ARRAY(id = 7)
62 ; CHECK-NEXT:        .long   50331648                # 0x3000000
63 ; CHECK-NEXT:        .long   0
64 ; CHECK-NEXT:        .long   6
65 ; CHECK-NEXT:        .long   8
66 ; CHECK-NEXT:        .long   0
67 ; CHECK-NEXT:        .long   66                      # BTF_KIND_INT(id = 8)
68 ; CHECK-NEXT:        .long   16777216                # 0x1000000
69 ; CHECK-NEXT:        .long   4
70 ; CHECK-NEXT:        .long   32                      # 0x20
71 ; CHECK-NEXT:        .long   86                      # BTF_KIND_VAR(id = 9)
72 ; CHECK-NEXT:        .long   234881024               # 0xe000000
73 ; CHECK-NEXT:        .long   4
74 ; CHECK-NEXT:        .long   0
75 ; CHECK-NEXT:        .long   89                      # BTF_KIND_DATASEC(id = 10)
76 ; CHECK-NEXT:        .long   251658241               # 0xf000001
77 ; CHECK-NEXT:        .long   0
78 ; CHECK-NEXT:        .long   9
79 ; CHECK-NEXT:        .long   sv
80 ; CHECK-NEXT:        .long   20
81 ; CHECK-NEXT:        .byte   0                       # string offset=0
82 ; CHECK-NEXT:        .ascii  "int"                   # string offset=1
83 ; CHECK-NEXT:        .byte   0
84 ; CHECK-NEXT:        .ascii  "test"                  # string offset=5
85 ; CHECK-NEXT:        .byte   0
86 ; CHECK-NEXT:        .ascii  ".text"                 # string offset=10
87 ; CHECK-NEXT:        .byte   0
88 ; CHECK-NEXT:        .ascii  "/home/yhs/work/tests/llvm/bug/test.c" # string offset=16
89 ; CHECK-NEXT:        .byte   0
90 ; CHECK-NEXT:        .byte   116                     # string offset=53
91 ; CHECK-NEXT:        .byte   0
92 ; CHECK-NEXT:        .byte   97                      # string offset=55
93 ; CHECK-NEXT:        .byte   0
94 ; CHECK-NEXT:        .byte   98                      # string offset=57
95 ; CHECK-NEXT:        .byte   0
96 ; CHECK-NEXT:        .byte   99                      # string offset=59
97 ; CHECK-NEXT:        .byte   0
98 ; CHECK-NEXT:        .ascii  "char"                  # string offset=61
99 ; CHECK-NEXT:        .byte   0
100 ; CHECK-NEXT:        .ascii  "__ARRAY_SIZE_TYPE__"   # string offset=66
101 ; CHECK-NEXT:        .byte   0
102 ; CHECK-NEXT:        .ascii  "sv"                    # string offset=86
103 ; CHECK-NEXT:        .byte   0
104 ; CHECK-NEXT:        .ascii  ".data"                 # string offset=89
105 ; CHECK-NEXT:        .byte   0
107 attributes #0 = { norecurse nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
109 !llvm.dbg.cu = !{!2}
110 !llvm.module.flags = !{!17, !18, !19}
111 !llvm.ident = !{!20}
113 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
114 !1 = distinct !DIGlobalVariable(name: "sv", scope: !2, file: !3, line: 6, type: !6, isLocal: true, isDefinition: true)
115 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 8.0.20181009 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)
116 !3 = !DIFile(filename: "test.c", directory: "/home/yhs/work/tests/llvm/bug")
117 !4 = !{}
118 !5 = !{!0}
119 !6 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7)
120 !7 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t", file: !3, line: 1, size: 64, elements: !8)
121 !8 = !{!9, !11, !12}
122 !9 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !7, file: !3, line: 2, baseType: !10, size: 32)
123 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
124 !11 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !7, file: !3, line: 3, baseType: !10, size: 32, offset: 32)
125 !12 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !7, file: !3, line: 4, baseType: !13, offset: 64)
126 !13 = !DICompositeType(tag: DW_TAG_array_type, baseType: !14, elements: !15)
127 !14 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
128 !15 = !{!16}
129 !16 = !DISubrange(count: -1)
130 !17 = !{i32 2, !"Dwarf Version", i32 4}
131 !18 = !{i32 2, !"Debug Info Version", i32 3}
132 !19 = !{i32 1, !"wchar_size", i32 4}
133 !20 = !{!"clang version 8.0.20181009 "}
134 !21 = distinct !DISubprogram(name: "test", scope: !3, file: !3, line: 7, type: !22, isLocal: false, isDefinition: true, scopeLine: 7, isOptimized: true, unit: !2, retainedNodes: !4)
135 !22 = !DISubroutineType(types: !23)
136 !23 = !{!10}
137 !24 = !DILocation(line: 7, column: 24, scope: !21)
138 !25 = !{!26, !26, i64 0}
139 !26 = !{!"int", !27, i64 0}
140 !27 = !{!"omnipotent char", !28, i64 0}
141 !28 = !{!"Simple C/C++ TBAA"}
142 !29 = !DILocation(line: 7, column: 14, scope: !21)