[TTI] getTypeBasedIntrinsicInstrCost - add basic handling for strided load/store...
[llvm-project.git] / llvm / test / CodeGen / BPF / BTF / local-var.ll
blobdd79923b6b7bae5ad4da86a856b11891cf342255
1 ; RUN: llc -mtriple=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
2 ; RUN: llc -mtriple=bpfeb -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
4 ; Source code:
5 ;   int foo(char a) { volatile short b = 0;  return b; }
6 ; Compilation flag:
7 ;   clang -target bpf -O2 -g -S -emit-llvm test.c
9 ; Function Attrs: nounwind
10 define dso_local i32 @foo(i8 signext) local_unnamed_addr #0 !dbg !7 {
11   %2 = alloca i16, align 2
12   call void @llvm.dbg.value(metadata i8 %0, metadata !13, metadata !DIExpression()), !dbg !17
13   call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %2), !dbg !18
14   call void @llvm.dbg.declare(metadata ptr %2, metadata !14, metadata !DIExpression()), !dbg !19
15   store volatile i16 0, ptr %2, align 2, !dbg !19, !tbaa !20
16   %3 = load volatile i16, ptr %2, align 2, !dbg !24, !tbaa !20
17   %4 = sext i16 %3 to i32, !dbg !24
18   call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %2), !dbg !25
19   ret i32 %4, !dbg !26
22 ; CHECK:             .section        .BTF,"",@progbits
23 ; CHECK-NEXT:        .short  60319                   # 0xeb9f
24 ; CHECK-NEXT:        .byte   1
25 ; CHECK-NEXT:        .byte   0
26 ; CHECK-NEXT:        .long   24
27 ; CHECK-NEXT:        .long   0
28 ; CHECK-NEXT:        .long   64
29 ; CHECK-NEXT:        .long   64
30 ; CHECK-NEXT:        .long   59
31 ; CHECK-NEXT:        .long   1                       # BTF_KIND_INT(id = 1)
32 ; CHECK-NEXT:        .long   16777216                # 0x1000000
33 ; CHECK-NEXT:        .long   1
34 ; CHECK-NEXT:        .long   16777224                # 0x1000008
35 ; CHECK-NEXT:        .long   0                       # BTF_KIND_FUNC_PROTO(id = 2)
36 ; CHECK-NEXT:        .long   218103809               # 0xd000001
37 ; CHECK-NEXT:        .long   3
38 ; CHECK-NEXT:        .long   6
39 ; CHECK-NEXT:        .long   1
40 ; CHECK-NEXT:        .long   8                       # BTF_KIND_INT(id = 3)
41 ; CHECK-NEXT:        .long   16777216                # 0x1000000
42 ; CHECK-NEXT:        .long   4
43 ; CHECK-NEXT:        .long   16777248                # 0x1000020
44 ; CHECK-NEXT:        .long   12                      # BTF_KIND_FUNC(id = 4)
45 ; CHECK-NEXT:        .long   201326593               # 0xc000001
46 ; CHECK-NEXT:        .long   2
47 ; CHECK-NEXT:        .byte   0                       # string offset=0
48 ; CHECK-NEXT:        .ascii  "char"                  # string offset=1
49 ; CHECK-NEXT:        .byte   0
50 ; CHECK-NEXT:        .byte   97                      # string offset=6
51 ; CHECK-NEXT:        .byte   0
52 ; CHECK-NEXT:        .ascii  "int"                   # string offset=8
53 ; CHECK-NEXT:        .byte   0
54 ; CHECK-NEXT:        .ascii  "foo"                   # string offset=12
55 ; CHECK-NEXT:        .byte   0
56 ; CHECK-NEXT:        .ascii  ".text"                 # string offset=16
57 ; CHECK-NEXT:        .byte   0
58 ; CHECK-NEXT:        .ascii  "/home/yhs/work/tests/llvm/bug/test.c" # string offset=22
59 ; CHECK-NEXT:        .byte   0
61 ; Function Attrs: nounwind readnone speculatable
62 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
64 ; Function Attrs: argmemonly nounwind
65 declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #2
67 ; Function Attrs: argmemonly nounwind
68 declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #2
70 ; Function Attrs: nounwind readnone speculatable
71 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
73 attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "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" }
74 attributes #1 = { nounwind readnone speculatable }
75 attributes #2 = { argmemonly nounwind }
77 !llvm.dbg.cu = !{!0}
78 !llvm.module.flags = !{!3, !4, !5}
79 !llvm.ident = !{!6}
81 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 8.0.20181009 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
82 !1 = !DIFile(filename: "test.c", directory: "/home/yhs/work/tests/llvm/bug")
83 !2 = !{}
84 !3 = !{i32 2, !"Dwarf Version", i32 4}
85 !4 = !{i32 2, !"Debug Info Version", i32 3}
86 !5 = !{i32 1, !"wchar_size", i32 4}
87 !6 = !{!"clang version 8.0.20181009 "}
88 !7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12)
89 !8 = !DISubroutineType(types: !9)
90 !9 = !{!10, !11}
91 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
92 !11 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
93 !12 = !{!13, !14}
94 !13 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 1, type: !11)
95 !14 = !DILocalVariable(name: "b", scope: !7, file: !1, line: 1, type: !15)
96 !15 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !16)
97 !16 = !DIBasicType(name: "short", size: 16, encoding: DW_ATE_signed)
98 !17 = !DILocation(line: 1, column: 14, scope: !7)
99 !18 = !DILocation(line: 1, column: 19, scope: !7)
100 !19 = !DILocation(line: 1, column: 34, scope: !7)
101 !20 = !{!21, !21, i64 0}
102 !21 = !{!"short", !22, i64 0}
103 !22 = !{!"omnipotent char", !23, i64 0}
104 !23 = !{!"Simple C/C++ TBAA"}
105 !24 = !DILocation(line: 1, column: 49, scope: !7)
106 !25 = !DILocation(line: 1, column: 52, scope: !7)
107 !26 = !DILocation(line: 1, column: 42, scope: !7)