63 lines · plain
1; RUN: opt -O2 %s | llvm-dis > %t12; RUN: llc -filetype=obj -o - %t1 | llvm-readelf -s - | FileCheck -check-prefixes=CHECK %s3; RUN: llc -filetype=obj -addrsig -o - %t1 | llvm-readelf -s - | FileCheck -check-prefixes=CHECK %s4;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.c12 13target triple = "bpf"14 15%struct.tt = type { i32 }16 17; Function Attrs: nounwind readonly18define dso_local i32 @test(ptr readonly %arg) local_unnamed_addr !dbg !7 {19entry:20 call void @llvm.dbg.value(metadata ptr %arg, metadata !16, metadata !DIExpression()), !dbg !1721 %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 !1222 %1 = load i32, ptr %0, align 4, !dbg !18, !tbaa !1923 ret i32 %1, !dbg !2424}25 26; CHECK-NOT: llvm.tt:0:0$0:027 28; Function Attrs: nounwind readnone29declare ptr @llvm.preserve.struct.access.index.p0.p0.tts(ptr, i32, i32)30 31; Function Attrs: nounwind readnone speculatable32declare void @llvm.dbg.value(metadata, metadata, metadata)33 34!llvm.dbg.cu = !{!0}35!llvm.module.flags = !{!3, !4, !5}36!llvm.ident = !{!6}37 38!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)39!1 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/bug")40!2 = !{}41!3 = !{i32 7, !"Dwarf Version", i32 4}42!4 = !{i32 2, !"Debug Info Version", i32 3}43!5 = !{i32 1, !"wchar_size", i32 4}44!6 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git 947f9692440836dcb8d88b74b69dd379d85974ce)"}45!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)46!8 = !DISubroutineType(types: !9)47!9 = !{!10, !11}48!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)49!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64)50!12 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "tt", file: !1, line: 1, size: 32, elements: !13)51!13 = !{!14}52!14 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !12, file: !1, line: 1, baseType: !10, size: 32)53!15 = !{!16}54!16 = !DILocalVariable(name: "arg", arg: 1, scope: !7, file: !1, line: 2, type: !11)55!17 = !DILocation(line: 0, scope: !7)56!18 = !DILocation(line: 3, column: 15, scope: !7)57!19 = !{!20, !21, i64 0}58!20 = !{!"tt", !21, i64 0}59!21 = !{!"int", !22, i64 0}60!22 = !{!"omnipotent char", !23, i64 0}61!23 = !{!"Simple C/C++ TBAA"}62!24 = !DILocation(line: 3, column: 3, scope: !7)63