92 lines · plain
1; RUN: llc -mtriple=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s2; RUN: llc -mtriple=bpfeb -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s3;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.c10 11; Function Attrs: nounwind12define dso_local i32 @test2() local_unnamed_addr !dbg !12 {13entry:14 %call = tail call fastcc i32 @test1(), !dbg !1315 ret i32 %call, !dbg !1416}17; Function Attrs: noinline nounwind18define internal fastcc i32 @test1() unnamed_addr !dbg !15 {19entry:20 %call = tail call i32 @foo(), !dbg !1621 ret i32 %call, !dbg !1722}23declare !dbg !4 dso_local i32 @foo() local_unnamed_addr24 25; CHECK: .section .BTF,"",@progbits26; CHECK-NEXT: .short 60319 # 0xeb9f27; CHECK-NEXT: .byte 128; CHECK-NEXT: .byte 029; CHECK-NEXT: .long 2430; CHECK-NEXT: .long 031; CHECK-NEXT: .long 8832; CHECK-NEXT: .long 8833; CHECK-NEXT: .long 6434; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 1)35; CHECK-NEXT: .long 218103808 # 0xd00000036; CHECK-NEXT: .long 237; CHECK-NEXT: .long 1 # BTF_KIND_INT(id = 2)38; CHECK-NEXT: .long 16777216 # 0x100000039; CHECK-NEXT: .long 440; CHECK-NEXT: .long 16777248 # 0x100002041; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3)42; CHECK-NEXT: .long 201326593 # 0xc00000143; CHECK-NEXT: .long 144; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 4)45; CHECK-NEXT: .long 218103808 # 0xd00000046; CHECK-NEXT: .long 247; CHECK-NEXT: .long 54 # BTF_KIND_FUNC(id = 5)48; CHECK-NEXT: .long 201326592 # 0xc00000049; CHECK-NEXT: .long 450; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 6)51; CHECK-NEXT: .long 218103808 # 0xd00000052; CHECK-NEXT: .long 253; CHECK-NEXT: .long 60 # BTF_KIND_FUNC(id = 7)54; CHECK-NEXT: .long 201326594 # 0xc00000255; CHECK-NEXT: .long 656; CHECK-NEXT: .byte 057; CHECK-NEXT: .ascii "int" # string offset=158; CHECK-NEXT: .byte 059; CHECK-NEXT: .ascii "test2" # string offset=560; CHECK-NEXT: .byte 061; CHECK-NEXT: .ascii ".text" # string offset=1162; CHECK-NEXT: .byte 063; CHECK-NEXT: .ascii "/tmp/home/yhs/work/tests/bugs/test.c" # string offset=1764; CHECK-NEXT: .byte 065; CHECK-NEXT: .ascii "test1" # string offset=5466; CHECK-NEXT: .byte 067; CHECK-NEXT: .ascii "foo" # string offset=6068; CHECK-NEXT: .byte 069 70!llvm.dbg.cu = !{!0}71!llvm.module.flags = !{!8, !9, !10}72!llvm.ident = !{!11}73 74!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)75!1 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/bugs")76!2 = !{}77!3 = !{!4}78!4 = !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)79!5 = !DISubroutineType(types: !6)80!6 = !{!7}81!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)82!8 = !{i32 7, !"Dwarf Version", i32 4}83!9 = !{i32 2, !"Debug Info Version", i32 3}84!10 = !{i32 1, !"wchar_size", i32 4}85!11 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git 000f95c4157aee07bd4ffc3f59ffdb6c7ecae4af)"}86!12 = distinct !DISubprogram(name: "test2", scope: !1, file: !1, line: 3, type: !5, scopeLine: 3, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)87!13 = !DILocation(line: 3, column: 22, scope: !12)88!14 = !DILocation(line: 3, column: 15, scope: !12)89!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)90!16 = !DILocation(line: 2, column: 55, scope: !15)91!17 = !DILocation(line: 2, column: 48, scope: !15)92