50 lines · plain
1; RUN: llc -mtriple=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s2; Source Code:3; int test(int a, int b) { return a + b; }4; Compilation flag:5; clang -target bpf -g -S -emit-llvm test.c6 7; Function Attrs: noinline nounwind optnone8define dso_local i32 @test(i32 %a, i32 %b) !dbg !7 {9entry:10 %a.addr = alloca i32, align 411 %b.addr = alloca i32, align 412 store i32 %a, ptr %a.addr, align 413 call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !11, metadata !DIExpression()), !dbg !1214 store i32 %b, ptr %b.addr, align 415 call void @llvm.dbg.declare(metadata ptr %b.addr, metadata !13, metadata !DIExpression()), !dbg !1416 %0 = load i32, ptr %a.addr, align 4, !dbg !1517 %1 = load i32, ptr %b.addr, align 4, !dbg !1618 %add = add nsw i32 %0, %1, !dbg !1719 ret i32 %add, !dbg !1820}21 22; CHECK-LABEL: test23 24; Function Attrs: nounwind readnone speculatable25declare void @llvm.dbg.declare(metadata, metadata, metadata)26 27!llvm.dbg.cu = !{!0}28!llvm.module.flags = !{!3, !4, !5}29!llvm.ident = !{!6}30 31!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git 7f49dc496682e38335b204bbae371a0ca5057719)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)32!1 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/llvm")33!2 = !{}34!3 = !{i32 7, !"Dwarf Version", i32 4}35!4 = !{i32 2, !"Debug Info Version", i32 3}36!5 = !{i32 1, !"wchar_size", i32 4}37!6 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 7f49dc496682e38335b204bbae371a0ca5057719)"}38!7 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)39!8 = !DISubroutineType(types: !9)40!9 = !{!10, !10, !10}41!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)42!11 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 1, type: !10)43!12 = !DILocation(line: 1, column: 14, scope: !7)44!13 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !1, line: 1, type: !10)45!14 = !DILocation(line: 1, column: 21, scope: !7)46!15 = !DILocation(line: 1, column: 33, scope: !7)47!16 = !DILocation(line: 1, column: 37, scope: !7)48!17 = !DILocation(line: 1, column: 35, scope: !7)49!18 = !DILocation(line: 1, column: 26, scope: !7)50