brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.7 KiB · 1ce453c Raw
93 lines · plain
1; RUN: opt -O2 %s | llvm-dis > %t12; RUN: llc -filetype=asm -o - %t1 | FileCheck %s3; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck %s4;5; Source code:6;   struct s { int a; int b; };7;   struct t { int c; int d; };8;   #define _(x) (__builtin_preserve_access_index(x))9;   int get_value(const ptr addr1, const ptr addr2);10;   int test(struct s *arg1, struct t *arg2) {11;     return get_value(_(&arg1->b), _(&arg2->d));12;   }13; clang -target bpf -S -O2 -g -emit-llvm -Xclang -disable-llvm-passes test.c14 15target triple = "bpf"16 17%struct.s = type { i32, i32 }18%struct.t = type { i32, i32 }19 20; Function Attrs: nounwind21define dso_local i32 @test(ptr %arg1, ptr %arg2) local_unnamed_addr !dbg !7 {22entry:23  call void @llvm.dbg.value(metadata ptr %arg1, metadata !22, metadata !DIExpression()), !dbg !2424  call void @llvm.dbg.value(metadata ptr %arg2, metadata !23, metadata !DIExpression()), !dbg !2425  %0 = tail call ptr @llvm.preserve.struct.access.index.p0.p0.ss(ptr elementtype(%struct.s) %arg1, i32 1, i32 1), !dbg !25, !llvm.preserve.access.index !1226  %1 = tail call ptr @llvm.preserve.struct.access.index.p0.p0.ts(ptr elementtype(%struct.t) %arg2, i32 1, i32 1), !dbg !26, !llvm.preserve.access.index !1727  %call = tail call i32 @get_value(ptr %0, ptr %1), !dbg !2728  ret i32 %call, !dbg !2829}30 31; CHECK:             .section        .BTF,"",@progbits32; CHECK:             .ascii  ".text"                 # string offset=[[SEC_INDEX:[0-9]+]]33; CHECK-NEXT:        .byte   034; CHECK:             .ascii  "0:1"                   # string offset=[[ACCESS_STR:[0-9]+]]35; CHECK-NEXT:        .byte   036; CHECK:             .section        .BTF.ext,"",@progbits37; CHECK:             .long   16                      # FieldReloc38; CHECK-NEXT:        .long   [[SEC_INDEX]]           # Field reloc section string offset=[[SEC_INDEX]]39; CHECK-NEXT:        .long   240; CHECK-NEXT:        .long   .Ltmp{{[0-9]+}}41; CHECK-NEXT:        .long   {{[0-9]+}}42; CHECK-NEXT:        .long   [[ACCESS_STR]]43; CHECK-NEXT:        .long   044; CHECK-NEXT:        .long   .Ltmp{{[0-9]+}}45; CHECK-NEXT:        .long   {{[0-9]+}}46; CHECK-NEXT:        .long   [[ACCESS_STR]]47; CHECK-NEXT:        .long   048 49declare dso_local i32 @get_value(ptr, ptr) local_unnamed_addr50 51; Function Attrs: nounwind readnone52declare ptr @llvm.preserve.struct.access.index.p0.p0.ss(ptr, i32 immarg, i32 immarg)53 54; Function Attrs: nounwind readnone55declare ptr @llvm.preserve.struct.access.index.p0.p0.ts(ptr, i32 immarg, i32 immarg)56 57; Function Attrs: nounwind readnone speculatable58declare void @llvm.dbg.value(metadata, metadata, metadata)59 60!llvm.dbg.cu = !{!0}61!llvm.module.flags = !{!3, !4, !5}62!llvm.ident = !{!6}63 64!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (trunk 366831) (llvm/trunk 366867)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)65!1 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/llvm/core-bugs")66!2 = !{}67!3 = !{i32 2, !"Dwarf Version", i32 4}68!4 = !{i32 2, !"Debug Info Version", i32 3}69!5 = !{i32 1, !"wchar_size", i32 4}70!6 = !{!"clang version 10.0.0 (trunk 366831) (llvm/trunk 366867)"}71!7 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 5, type: !8, scopeLine: 5, flags: DIFlagPrototyped, isDefinition: true, isOptimized: true, unit: !0, retainedNodes: !21)72!8 = !DISubroutineType(types: !9)73!9 = !{!10, !11, !16}74!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)75!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64)76!12 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s", file: !1, line: 1, size: 64, elements: !13)77!13 = !{!14, !15}78!14 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !12, file: !1, line: 1, baseType: !10, size: 32)79!15 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !12, file: !1, line: 1, baseType: !10, size: 32, offset: 32)80!16 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !17, size: 64)81!17 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t", file: !1, line: 2, size: 64, elements: !18)82!18 = !{!19, !20}83!19 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !17, file: !1, line: 2, baseType: !10, size: 32)84!20 = !DIDerivedType(tag: DW_TAG_member, name: "d", scope: !17, file: !1, line: 2, baseType: !10, size: 32, offset: 32)85!21 = !{!22, !23}86!22 = !DILocalVariable(name: "arg1", arg: 1, scope: !7, file: !1, line: 5, type: !11)87!23 = !DILocalVariable(name: "arg2", arg: 2, scope: !7, file: !1, line: 5, type: !16)88!24 = !DILocation(line: 0, scope: !7)89!25 = !DILocation(line: 6, column: 20, scope: !7)90!26 = !DILocation(line: 6, column: 33, scope: !7)91!27 = !DILocation(line: 6, column: 10, scope: !7)92!28 = !DILocation(line: 6, column: 3, scope: !7)93