brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 983383c Raw
60 lines · plain
1; RUN: opt -O2 %s | llvm-dis > %t12; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK %s3; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK %s4; Source code:5;   #define _(x) (__builtin_preserve_access_index(x))6;   int get_value(const int *arg);7;   int test(int *arg) {8;     return get_value(_(&arg[4]));9;   }10; Compilation flag:11;   clang -target bpf -O2 -g -S -emit-llvm -Xclang -disable-llvm-passes test.c12 13target triple = "bpf"14 15; Function Attrs: nounwind16define dso_local i32 @test(ptr %arg) local_unnamed_addr !dbg !10 {17entry:18  call void @llvm.dbg.value(metadata ptr %arg, metadata !14, metadata !DIExpression()), !dbg !1519  %0 = tail call ptr @llvm.preserve.array.access.index.p0.p0(ptr elementtype(i32) %arg, i32 0, i32 4), !dbg !16, !llvm.preserve.access.index !420  %call = tail call i32 @get_value(ptr %0), !dbg !1721  ret i32 %call, !dbg !1822}23 24; CHECK:             r1 += 1625; CHECK:             call get_value26; CHECK:             .section        .BTF.ext,"",@progbits27; CHECK-NOT:         .long   16                      # FieldReloc28 29declare dso_local i32 @get_value(ptr) local_unnamed_addr30 31; Function Attrs: nounwind readnone32declare ptr @llvm.preserve.array.access.index.p0.p0(ptr, i32, i32)33 34; Function Attrs: nounwind readnone speculatable willreturn35declare void @llvm.dbg.value(metadata, metadata, metadata)36 37!llvm.dbg.cu = !{!0}38!llvm.module.flags = !{!6, !7, !8}39!llvm.ident = !{!9}40 41!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (trunk 367256) (llvm/trunk 367266)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)42!1 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/llvm/cast")43!2 = !{}44!3 = !{!4}45!4 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !5, size: 64)46!5 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)47!6 = !{i32 2, !"Dwarf Version", i32 4}48!7 = !{i32 2, !"Debug Info Version", i32 3}49!8 = !{i32 1, !"wchar_size", i32 4}50!9 = !{!"clang version 10.0.0 (trunk 367256) (llvm/trunk 367266)"}51!10 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 3, type: !11, scopeLine: 3, flags: DIFlagPrototyped, isDefinition: true, isOptimized: true, unit: !0, retainedNodes: !13)52!11 = !DISubroutineType(types: !12)53!12 = !{!5, !4}54!13 = !{!14}55!14 = !DILocalVariable(name: "arg", arg: 1, scope: !10, file: !1, line: 3, type: !4)56!15 = !DILocation(line: 0, scope: !10)57!16 = !DILocation(line: 4, column: 20, scope: !10)58!17 = !DILocation(line: 4, column: 10, scope: !10)59!18 = !DILocation(line: 4, column: 3, scope: !10)60