114 lines · plain
1; RUN: llc -mtriple=bpfel -o - %s | FileCheck %s2; RUN: llc -mtriple=bpfeb -o - %s | FileCheck %s3; Source:4; struct t1 {5; int a;6; };7; struct t2 {8; struct t1 *p1;9; struct t1 *p2;10; int b;11; };12; int foo(struct t2 *arg) {13; return arg->b;14; }15; Compilation flags:16; clang -target bpf -O2 -g -S -emit-llvm t.c17 18%struct.t2 = type { ptr, ptr, i32 }19 20; Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind readonly willreturn21define dso_local i32 @foo(ptr nocapture noundef readonly %arg) local_unnamed_addr #0 !dbg !7 {22entry:23 call void @llvm.dbg.value(metadata ptr %arg, metadata !22, metadata !DIExpression()), !dbg !2324 %b = getelementptr inbounds %struct.t2, ptr %arg, i64 0, i32 2, !dbg !2425 %0 = load i32, ptr %b, align 8, !dbg !24, !tbaa !2526 ret i32 %0, !dbg !3127}28 29; CHECK: .long 0 # BTF_KIND_PTR(id = 1)30; CHECK-NEXT: .long 33554432 # 0x200000031; CHECK-NEXT: .long 232; CHECK-NEXT: .long 1 # BTF_KIND_STRUCT(id = 2)33; CHECK-NEXT: .long 67108867 # 0x400000334; CHECK-NEXT: .long 2435; CHECK-NEXT: .long 436; CHECK-NEXT: .long 337; CHECK-NEXT: .long 0 # 0x038; CHECK-NEXT: .long 739; CHECK-NEXT: .long 340; CHECK-NEXT: .long 64 # 0x4041; CHECK-NEXT: .long 1042; CHECK-NEXT: .long 443; CHECK-NEXT: .long 128 # 0x8044; CHECK-NEXT: .long 0 # BTF_KIND_PTR(id = 3)45; CHECK-NEXT: .long 33554432 # 0x200000046; CHECK-NEXT: .long 747; CHECK-NEXT: .long 12 # BTF_KIND_INT(id = 4)48; CHECK-NEXT: .long 16777216 # 0x100000049; CHECK-NEXT: .long 450; CHECK-NEXT: .long 16777248 # 0x100002051; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 5)52; CHECK-NEXT: .long 218103809 # 0xd00000153; CHECK-NEXT: .long 454; CHECK-NEXT: .long 1655; CHECK-NEXT: .long 156; CHECK-NEXT: .long 20 # BTF_KIND_FUNC(id = 6)57; CHECK-NEXT: .long 201326593 # 0xc00000158; CHECK-NEXT: .long 559; CHECK-NEXT: .long 60 # BTF_KIND_FWD(id = 7)60; CHECK-NEXT: .long 117440512 # 0x700000061; CHECK-NEXT: .long 062 63; CHECK: .ascii "t2" # string offset=164; CHECK: .ascii "p1" # string offset=465; CHECK: .ascii "p2" # string offset=766; CHECK: .byte 98 # string offset=1067; CHECK: .ascii "int" # string offset=1268; CHECK: .ascii "arg" # string offset=1669; CHECK: .ascii "foo" # string offset=2070; CHECK: .ascii "t1" # string offset=6071 72; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn73declare void @llvm.dbg.value(metadata, metadata, metadata) #174 75attributes #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" }76attributes #1 = { nocallback nofree nosync nounwind readnone speculatable willreturn }77 78!llvm.dbg.cu = !{!0}79!llvm.module.flags = !{!2, !3, !4, !5}80!llvm.ident = !{!6}81 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)91!9 = !{!10, !11}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)99!17 = !{!18}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)103!21 = !{!22}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)114