• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
2; Source Code:
3;   int test(int a, int b) { return a + b; }
4; Compilation flag:
5;   clang -target bpf -g -S -emit-llvm test.c
6
7; Function Attrs: noinline nounwind optnone
8define dso_local i32 @test(i32 %a, i32 %b) #0 !dbg !7 {
9entry:
10  %a.addr = alloca i32, align 4
11  %b.addr = alloca i32, align 4
12  store i32 %a, i32* %a.addr, align 4
13  call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !11, metadata !DIExpression()), !dbg !12
14  store i32 %b, i32* %b.addr, align 4
15  call void @llvm.dbg.declare(metadata i32* %b.addr, metadata !13, metadata !DIExpression()), !dbg !14
16  %0 = load i32, i32* %a.addr, align 4, !dbg !15
17  %1 = load i32, i32* %b.addr, align 4, !dbg !16
18  %add = add nsw i32 %0, %1, !dbg !17
19  ret i32 %add, !dbg !18
20}
21
22; CHECK-LABEL: test
23
24; Function Attrs: nounwind readnone speculatable
25declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
26
27attributes #0 = { noinline nounwind optnone "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" }
28attributes #1 = { nounwind readnone speculatable}
29
30!llvm.dbg.cu = !{!0}
31!llvm.module.flags = !{!3, !4, !5}
32!llvm.ident = !{!6}
33
34!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)
35!1 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/llvm")
36!2 = !{}
37!3 = !{i32 7, !"Dwarf Version", i32 4}
38!4 = !{i32 2, !"Debug Info Version", i32 3}
39!5 = !{i32 1, !"wchar_size", i32 4}
40!6 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 7f49dc496682e38335b204bbae371a0ca5057719)"}
41!7 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
42!8 = !DISubroutineType(types: !9)
43!9 = !{!10, !10, !10}
44!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
45!11 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 1, type: !10)
46!12 = !DILocation(line: 1, column: 14, scope: !7)
47!13 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !1, line: 1, type: !10)
48!14 = !DILocation(line: 1, column: 21, scope: !7)
49!15 = !DILocation(line: 1, column: 33, scope: !7)
50!16 = !DILocation(line: 1, column: 37, scope: !7)
51!17 = !DILocation(line: 1, column: 35, scope: !7)
52!18 = !DILocation(line: 1, column: 26, scope: !7)
53