Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / CodeGen / BPF / BTF / static-func.ll
blob9227cf0667c66d6bd61a00e3611f71892d2f2b1a
1 ; RUN: llc -march=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
2 ; RUN: llc -march=bpfeb -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
4 ; Source code:
5 ;   extern int foo(void);
6 ;   static __attribute__((noinline)) int test1() { return foo(); }
7 ;   int test2() { return test1(); }
8 ; Compilation flag:
9 ;   clang -target bpf -O2 -g -S -emit-llvm test.c
11 ; Function Attrs: nounwind
12 define dso_local i32 @test2() local_unnamed_addr #0 !dbg !12 {
13 entry:
14   %call = tail call fastcc i32 @test1(), !dbg !13
15   ret i32 %call, !dbg !14
17 ; Function Attrs: noinline nounwind
18 define internal fastcc i32 @test1() unnamed_addr #1 !dbg !15 {
19 entry:
20   %call = tail call i32 @foo() #3, !dbg !16
21   ret i32 %call, !dbg !17
23 declare !dbg !4 dso_local i32 @foo() local_unnamed_addr #2
25 ; CHECK:             .section        .BTF,"",@progbits
26 ; CHECK-NEXT:        .short  60319                   # 0xeb9f
27 ; CHECK-NEXT:        .byte   1
28 ; CHECK-NEXT:        .byte   0
29 ; CHECK-NEXT:        .long   24
30 ; CHECK-NEXT:        .long   0
31 ; CHECK-NEXT:        .long   88
32 ; CHECK-NEXT:        .long   88
33 ; CHECK-NEXT:        .long   64
34 ; CHECK-NEXT:        .long   0                       # BTF_KIND_FUNC_PROTO(id = 1)
35 ; CHECK-NEXT:        .long   218103808               # 0xd000000
36 ; CHECK-NEXT:        .long   2
37 ; CHECK-NEXT:        .long   1                       # BTF_KIND_INT(id = 2)
38 ; CHECK-NEXT:        .long   16777216                # 0x1000000
39 ; CHECK-NEXT:        .long   4
40 ; CHECK-NEXT:        .long   16777248                # 0x1000020
41 ; CHECK-NEXT:        .long   5                       # BTF_KIND_FUNC(id = 3)
42 ; CHECK-NEXT:        .long   201326593               # 0xc000001
43 ; CHECK-NEXT:        .long   1
44 ; CHECK-NEXT:        .long   0                       # BTF_KIND_FUNC_PROTO(id = 4)
45 ; CHECK-NEXT:        .long   218103808               # 0xd000000
46 ; CHECK-NEXT:        .long   2
47 ; CHECK-NEXT:        .long   54                      # BTF_KIND_FUNC(id = 5)
48 ; CHECK-NEXT:        .long   201326592               # 0xc000000
49 ; CHECK-NEXT:        .long   4
50 ; CHECK-NEXT:        .long   0                       # BTF_KIND_FUNC_PROTO(id = 6)
51 ; CHECK-NEXT:        .long   218103808               # 0xd000000
52 ; CHECK-NEXT:        .long   2
53 ; CHECK-NEXT:        .long   60                      # BTF_KIND_FUNC(id = 7)
54 ; CHECK-NEXT:        .long   201326594               # 0xc000002
55 ; CHECK-NEXT:        .long   6
56 ; CHECK-NEXT:        .byte   0
57 ; CHECK-NEXT:        .ascii  "int"                   # string offset=1
58 ; CHECK-NEXT:        .byte   0
59 ; CHECK-NEXT:        .ascii  "test2"                 # string offset=5
60 ; CHECK-NEXT:        .byte   0
61 ; CHECK-NEXT:        .ascii  ".text"                 # string offset=11
62 ; CHECK-NEXT:        .byte   0
63 ; CHECK-NEXT:        .ascii  "/tmp/home/yhs/work/tests/bugs/test.c" # string offset=17
64 ; CHECK-NEXT:        .byte   0
65 ; CHECK-NEXT:        .ascii  "test1"                 # string offset=54
66 ; CHECK-NEXT:        .byte   0
67 ; CHECK-NEXT:        .ascii  "foo"                   # string offset=60
68 ; CHECK-NEXT:        .byte   0
70 attributes #0 = { nounwind "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" }
71 attributes #1 = { noinline nounwind "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" }
72 attributes #2 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="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" }
73 attributes #3 = { nounwind }
75 !llvm.dbg.cu = !{!0}
76 !llvm.module.flags = !{!8, !9, !10}
77 !llvm.ident = !{!11}
79 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (https://github.com/llvm/llvm-project.git 000f95c4157aee07bd4ffc3f59ffdb6c7ecae4af)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: None)
80 !1 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/bugs")
81 !2 = !{}
82 !3 = !{!4}
83 !4 = !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
84 !5 = !DISubroutineType(types: !6)
85 !6 = !{!7}
86 !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
87 !8 = !{i32 7, !"Dwarf Version", i32 4}
88 !9 = !{i32 2, !"Debug Info Version", i32 3}
89 !10 = !{i32 1, !"wchar_size", i32 4}
90 !11 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git 000f95c4157aee07bd4ffc3f59ffdb6c7ecae4af)"}
91 !12 = distinct !DISubprogram(name: "test2", scope: !1, file: !1, line: 3, type: !5, scopeLine: 3, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
92 !13 = !DILocation(line: 3, column: 22, scope: !12)
93 !14 = !DILocation(line: 3, column: 15, scope: !12)
94 !15 = distinct !DISubprogram(name: "test1", scope: !1, file: !1, line: 2, type: !5, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
95 !16 = !DILocation(line: 2, column: 55, scope: !15)
96 !17 = !DILocation(line: 2, column: 48, scope: !15)