1 ; RUN: opt -O2 %s | llvm-dis > %t1
2 ; RUN: llc -filetype=obj -o - %t1 | llvm-readelf -s - | FileCheck -check-prefixes=CHECK %s
3 ; RUN: llc -filetype=obj -addrsig -o - %t1 | llvm-readelf -s - | FileCheck -check-prefixes=CHECK %s
6 ; struct tt { int a; } __attribute__((preserve_access_index));
7 ; int test(struct tt *arg) {
11 ; clang -target bpf -O2 -g -S -emit-llvm -Xclang -disable-llvm-passes t.c
15 %struct.tt = type { i32 }
17 ; Function Attrs: nounwind readonly
18 define dso_local i32 @test(ptr readonly %arg) local_unnamed_addr #0 !dbg !7 {
20 call void @llvm.dbg.value(metadata ptr %arg, metadata !16, metadata !DIExpression()), !dbg !17
21 %0 = tail call ptr @llvm.preserve.struct.access.index.p0.p0.tts(ptr elementtype(%struct.tt) %arg, i32 0, i32 0), !dbg !18, !llvm.preserve.access.index !12
22 %1 = load i32, ptr %0, align 4, !dbg !18, !tbaa !19
26 ; CHECK-NOT: llvm.tt:0:0$0:0
28 ; Function Attrs: nounwind readnone
29 declare ptr @llvm.preserve.struct.access.index.p0.p0.tts(ptr, i32, i32) #1
31 ; Function Attrs: nounwind readnone speculatable
32 declare void @llvm.dbg.value(metadata, metadata, metadata) #2
34 attributes #0 = { nounwind readonly "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"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
35 attributes #1 = { nounwind readnone }
36 attributes #2 = { nounwind readnone speculatable}
39 !llvm.module.flags = !{!3, !4, !5}
42 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (https://github.com/llvm/llvm-project.git 947f9692440836dcb8d88b74b69dd379d85974ce)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
43 !1 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/bug")
45 !3 = !{i32 7, !"Dwarf Version", i32 4}
46 !4 = !{i32 2, !"Debug Info Version", i32 3}
47 !5 = !{i32 1, !"wchar_size", i32 4}
48 !6 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git 947f9692440836dcb8d88b74b69dd379d85974ce)"}
49 !7 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)
50 !8 = !DISubroutineType(types: !9)
52 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
53 !11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64)
54 !12 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "tt", file: !1, line: 1, size: 32, elements: !13)
56 !14 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !12, file: !1, line: 1, baseType: !10, size: 32)
58 !16 = !DILocalVariable(name: "arg", arg: 1, scope: !7, file: !1, line: 2, type: !11)
59 !17 = !DILocation(line: 0, scope: !7)
60 !18 = !DILocation(line: 3, column: 15, scope: !7)
61 !19 = !{!20, !21, i64 0}
62 !20 = !{!"tt", !21, i64 0}
63 !21 = !{!"int", !22, i64 0}
64 !22 = !{!"omnipotent char", !23, i64 0}
65 !23 = !{!"Simple C/C++ TBAA"}
66 !24 = !DILocation(line: 3, column: 3, scope: !7)