55 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; unsigned long foo(void) {6; return 42;7; }8; unsigned long bar(void) {9; return 1337;10; }11; Compilation flag:12; clang -target bpf -O2 -g -S -emit-llvm test.c -o - | sed -E 's/,? !dbg !(7|11)//'13 14; Function Attrs: noinline nounwind optnone15define dso_local i64 @foo() #0 {16entry:17 ret i64 4218}19 20; Function Attrs: noinline nounwind optnone21define dso_local i64 @bar() #0 !dbg !12 {22entry:23 ret i64 1337, !dbg !1324}25 26; CHECK: .section .BTF,"",@progbits27; CHECK: .long 0 # BTF_KIND_FUNC_PROTO(id = 1)28; CHECK: .long 1 # BTF_KIND_INT(id = 2)29; CHECK: .long 15 # BTF_KIND_FUNC(id = 3)30; CHECK: .byte 0 # string offset=031; CHECK: .ascii "unsigned long" # string offset=132; CHECK: .ascii "bar" # string offset=1533; CHECK: .ascii ".text" # string offset=1934 35attributes #0 = { noinline nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }36 37!llvm.dbg.cu = !{!0}38!llvm.module.flags = !{!2, !3, !4, !5}39!llvm.ident = !{!6}40 41!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 18.0.0 (https://github.com/llvm/llvm-project.git 8031b3f2c40d3fe622648b6731a0ae1dc3f37860)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)42!1 = !DIFile(filename: "test.c", directory: "/home/tamird/src/llvm-project-latest", checksumkind: CSK_MD5, checksum: "20bd72139e533d6aed61683730100513")43!2 = !{i32 7, !"Dwarf Version", i32 5}44!3 = !{i32 2, !"Debug Info Version", i32 3}45!4 = !{i32 1, !"wchar_size", i32 4}46!5 = !{i32 7, !"frame-pointer", i32 2}47!6 = !{!"clang version 18.0.0 (https://github.com/llvm/llvm-project.git 8031b3f2c40d3fe622648b6731a0ae1dc3f37860)"}48!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)49!8 = !DISubroutineType(types: !9)50!9 = !{!10}51!10 = !DIBasicType(name: "unsigned long", size: 64, encoding: DW_ATE_unsigned)52!11 = !DILocation(line: 2, column: 3, scope: !7)53!12 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 5, type: !8, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)54!13 = !DILocation(line: 6, column: 3, scope: !12)55