1 ; RUN: opt -O2 %s | llvm-dis > %t1
2 ; RUN: llc -filetype=asm -o - %t1 | FileCheck %s
3 ; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck %s
6 ; enum { FIELD_EXISTENCE = 2, };
7 ; struct s1 { int a1; };
10 ; return __builtin_preserve_field_info(v[0], FIELD_EXISTENCE);
13 ; clang -target bpf -O2 -g -S -emit-llvm -Xclang -disable-llvm-passes test.c
17 %struct.s1 = type { i32 }
19 ; Function Attrs: nounwind readnone
20 define dso_local i32 @test() local_unnamed_addr #0 !dbg !17 {
22 call void @llvm.dbg.value(metadata ptr null, metadata !21, metadata !DIExpression()), !dbg !22
23 %0 = tail call ptr @llvm.preserve.array.access.index.p0.s1s.p0.s1s(ptr elementtype(%struct.s1) null, i32 0, i32 0), !dbg !23, !llvm.preserve.access.index !8
24 %1 = tail call i32 @llvm.bpf.preserve.field.info.p0.s1s(ptr %0, i64 2), !dbg !24
28 ; CHECK: .long 16 # BTF_KIND_STRUCT(id = 4)
30 ; CHECK: .ascii ".text" # string offset=10
31 ; CHECK: .ascii "s1" # string offset=16
32 ; CHECK: .byte 48 # string offset=22
34 ; CHECK: .long 16 # FieldReloc
35 ; CHECK-NEXT: .long 10 # Field reloc section string offset=10
37 ; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
39 ; CHECK-NEXT: .long 22
42 ; Function Attrs: nounwind readnone
43 declare ptr @llvm.preserve.array.access.index.p0.s1s.p0.s1s(ptr, i32 immarg, i32 immarg) #1
45 ; Function Attrs: nounwind readnone
46 declare i32 @llvm.bpf.preserve.field.info.p0.s1s(ptr, i64 immarg) #1
48 ; Function Attrs: nounwind readnone speculatable willreturn
49 declare void @llvm.dbg.value(metadata, metadata, metadata) #2
51 attributes #0 = { nounwind readnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
52 attributes #1 = { nounwind readnone }
53 attributes #2 = { nounwind readnone speculatable willreturn }
56 !llvm.module.flags = !{!13, !14, !15}
59 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git 32791937d7aceb0a5e1eaabf1bb1a6dbe1639792)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !7, splitDebugInlining: false, nameTableKind: None)
60 !1 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/core")
62 !3 = !DICompositeType(tag: DW_TAG_enumeration_type, file: !1, line: 1, baseType: !4, size: 32, elements: !5)
63 !4 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)
65 !6 = !DIEnumerator(name: "FIELD_EXISTENCE", value: 2, isUnsigned: true)
67 !8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64)
68 !9 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s1", file: !1, line: 2, size: 32, elements: !10)
70 !11 = !DIDerivedType(tag: DW_TAG_member, name: "a1", scope: !9, file: !1, line: 2, baseType: !12, size: 32)
71 !12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
72 !13 = !{i32 7, !"Dwarf Version", i32 4}
73 !14 = !{i32 2, !"Debug Info Version", i32 3}
74 !15 = !{i32 1, !"wchar_size", i32 4}
75 !16 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 32791937d7aceb0a5e1eaabf1bb1a6dbe1639792)"}
76 !17 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 3, type: !18, scopeLine: 3, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !20)
77 !18 = !DISubroutineType(types: !19)
80 !21 = !DILocalVariable(name: "v", scope: !17, file: !1, line: 4, type: !8)
81 !22 = !DILocation(line: 0, scope: !17)
82 !23 = !DILocation(line: 5, column: 40, scope: !17)
83 !24 = !DILocation(line: 5, column: 10, scope: !17)
84 !25 = !DILocation(line: 5, column: 3, scope: !17)