1 ; RUN: llc -march=bpfel -o - %s | FileCheck %s
2 ; RUN: llc -march=bpfeb -o - %s | FileCheck %s
12 ; int foo(struct t2 *arg) {
16 ; clang -target bpf -O2 -g -S -emit-llvm t.c
18 %struct.t2 = type { ptr, ptr, i32 }
20 ; Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind readonly willreturn
21 define dso_local i32 @foo(ptr nocapture noundef readonly %arg) local_unnamed_addr #0 !dbg !7 {
23 call void @llvm.dbg.value(metadata ptr %arg, metadata !22, metadata !DIExpression()), !dbg !23
24 %b = getelementptr inbounds %struct.t2, ptr %arg, i64 0, i32 2, !dbg !24
25 %0 = load i32, ptr %b, align 8, !dbg !24, !tbaa !25
29 ; CHECK: .long 0 # BTF_KIND_PTR(id = 1)
30 ; CHECK-NEXT: .long 33554432 # 0x2000000
32 ; CHECK-NEXT: .long 1 # BTF_KIND_STRUCT(id = 2)
33 ; CHECK-NEXT: .long 67108867 # 0x4000003
34 ; CHECK-NEXT: .long 24
37 ; CHECK-NEXT: .long 0 # 0x0
40 ; CHECK-NEXT: .long 64 # 0x40
41 ; CHECK-NEXT: .long 10
43 ; CHECK-NEXT: .long 128 # 0x80
44 ; CHECK-NEXT: .long 0 # BTF_KIND_PTR(id = 3)
45 ; CHECK-NEXT: .long 33554432 # 0x2000000
47 ; CHECK-NEXT: .long 12 # BTF_KIND_INT(id = 4)
48 ; CHECK-NEXT: .long 16777216 # 0x1000000
50 ; CHECK-NEXT: .long 16777248 # 0x1000020
51 ; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 5)
52 ; CHECK-NEXT: .long 218103809 # 0xd000001
54 ; CHECK-NEXT: .long 16
56 ; CHECK-NEXT: .long 20 # BTF_KIND_FUNC(id = 6)
57 ; CHECK-NEXT: .long 201326593 # 0xc000001
59 ; CHECK-NEXT: .long 60 # BTF_KIND_FWD(id = 7)
60 ; CHECK-NEXT: .long 117440512 # 0x7000000
63 ; CHECK: .ascii "t2" # string offset=1
64 ; CHECK: .ascii "p1" # string offset=4
65 ; CHECK: .ascii "p2" # string offset=7
66 ; CHECK: .byte 98 # string offset=10
67 ; CHECK: .ascii "int" # string offset=12
68 ; CHECK: .ascii "arg" # string offset=16
69 ; CHECK: .ascii "foo" # string offset=20
70 ; CHECK: .ascii "t1" # string offset=60
72 ; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
73 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
75 attributes #0 = { argmemonly mustprogress nofree norecurse nosync nounwind readonly willreturn "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
76 attributes #1 = { nocallback nofree nosync nounwind readnone speculatable willreturn }
79 !llvm.module.flags = !{!2, !3, !4, !5}
82 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
83 !1 = !DIFile(filename: "t1.c", directory: "/tmp/home/yhs/tmp3/tests", checksumkind: CSK_MD5, checksum: "9a79ff24a6244249e556afd85288af94")
84 !2 = !{i32 7, !"Dwarf Version", i32 5}
85 !3 = !{i32 2, !"Debug Info Version", i32 3}
86 !4 = !{i32 1, !"wchar_size", i32 4}
87 !5 = !{i32 7, !"frame-pointer", i32 2}
88 !6 = !{!"clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)"}
89 !7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 9, type: !8, scopeLine: 9, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !21)
90 !8 = !DISubroutineType(types: !9)
92 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
93 !11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64)
94 !12 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t2", file: !1, line: 4, size: 192, elements: !13)
95 !13 = !{!14, !19, !20}
96 !14 = !DIDerivedType(tag: DW_TAG_member, name: "p1", scope: !12, file: !1, line: 5, baseType: !15, size: 64)
97 !15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64)
98 !16 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t1", file: !1, line: 1, size: 32, elements: !17)
100 !18 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !16, file: !1, line: 2, baseType: !10, size: 32)
101 !19 = !DIDerivedType(tag: DW_TAG_member, name: "p2", scope: !12, file: !1, line: 6, baseType: !15, size: 64, offset: 64)
102 !20 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !12, file: !1, line: 7, baseType: !10, size: 32, offset: 128)
104 !22 = !DILocalVariable(name: "arg", arg: 1, scope: !7, file: !1, line: 9, type: !11)
105 !23 = !DILocation(line: 0, scope: !7)
106 !24 = !DILocation(line: 10, column: 15, scope: !7)
107 !25 = !{!26, !30, i64 16}
108 !26 = !{!"t2", !27, i64 0, !27, i64 8, !30, i64 16}
109 !27 = !{!"any pointer", !28, i64 0}
110 !28 = !{!"omnipotent char", !29, i64 0}
111 !29 = !{!"Simple C/C++ TBAA"}
112 !30 = !{!"int", !28, i64 0}
113 !31 = !DILocation(line: 10, column: 3, scope: !7)