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 4; 5; Source Code: 6; struct tt { int a; } __attribute__((preserve_access_index)); 7; int test(struct tt *arg) { 8; return arg->a; 9; } 10; Compilation flag: 11; clang -target bpf -O2 -g -S -emit-llvm -Xclang -disable-llvm-passes t.c 12 13target triple = "bpf" 14 15%struct.tt = type { i32 } 16 17; Function Attrs: nounwind readonly 18define dso_local i32 @test(ptr readonly %arg) local_unnamed_addr #0 !dbg !7 { 19entry: 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 23 ret i32 %1, !dbg !24 24} 25 26; CHECK-NOT: llvm.tt:0:0$0:0 27 28; Function Attrs: nounwind readnone 29declare ptr @llvm.preserve.struct.access.index.p0.p0.tts(ptr, i32, i32) #1 30 31; Function Attrs: nounwind readnone speculatable 32declare void @llvm.dbg.value(metadata, metadata, metadata) #2 33 34attributes #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" } 35attributes #1 = { nounwind readnone } 36attributes #2 = { nounwind readnone speculatable} 37 38!llvm.dbg.cu = !{!0} 39!llvm.module.flags = !{!3, !4, !5} 40!llvm.ident = !{!6} 41 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") 44!2 = !{} 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) 51!9 = !{!10, !11} 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) 55!13 = !{!14} 56!14 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !12, file: !1, line: 1, baseType: !10, size: 32) 57!15 = !{!16} 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) 67