104 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; int foo(char a) { volatile short b = 0; return b; }6; Compilation flag:7; clang -target bpf -O2 -g -S -emit-llvm test.c8 9; Function Attrs: nounwind10define dso_local i32 @foo(i8 signext) local_unnamed_addr !dbg !7 {11 %2 = alloca i16, align 212 call void @llvm.dbg.value(metadata i8 %0, metadata !13, metadata !DIExpression()), !dbg !1713 call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %2), !dbg !1814 call void @llvm.dbg.declare(metadata ptr %2, metadata !14, metadata !DIExpression()), !dbg !1915 store volatile i16 0, ptr %2, align 2, !dbg !19, !tbaa !2016 %3 = load volatile i16, ptr %2, align 2, !dbg !24, !tbaa !2017 %4 = sext i16 %3 to i32, !dbg !2418 call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %2), !dbg !2519 ret i32 %4, !dbg !2620}21 22; CHECK: .section .BTF,"",@progbits23; CHECK-NEXT: .short 60319 # 0xeb9f24; CHECK-NEXT: .byte 125; CHECK-NEXT: .byte 026; CHECK-NEXT: .long 2427; CHECK-NEXT: .long 028; CHECK-NEXT: .long 6429; CHECK-NEXT: .long 6430; CHECK-NEXT: .long 5931; CHECK-NEXT: .long 1 # BTF_KIND_INT(id = 1)32; CHECK-NEXT: .long 16777216 # 0x100000033; CHECK-NEXT: .long 134; CHECK-NEXT: .long 16777224 # 0x100000835; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 2)36; CHECK-NEXT: .long 218103809 # 0xd00000137; CHECK-NEXT: .long 338; CHECK-NEXT: .long 639; CHECK-NEXT: .long 140; CHECK-NEXT: .long 8 # BTF_KIND_INT(id = 3)41; CHECK-NEXT: .long 16777216 # 0x100000042; CHECK-NEXT: .long 443; CHECK-NEXT: .long 16777248 # 0x100002044; CHECK-NEXT: .long 12 # BTF_KIND_FUNC(id = 4)45; CHECK-NEXT: .long 201326593 # 0xc00000146; CHECK-NEXT: .long 247; CHECK-NEXT: .byte 0 # string offset=048; CHECK-NEXT: .ascii "char" # string offset=149; CHECK-NEXT: .byte 050; CHECK-NEXT: .byte 97 # string offset=651; CHECK-NEXT: .byte 052; CHECK-NEXT: .ascii "int" # string offset=853; CHECK-NEXT: .byte 054; CHECK-NEXT: .ascii "foo" # string offset=1255; CHECK-NEXT: .byte 056; CHECK-NEXT: .ascii ".text" # string offset=1657; CHECK-NEXT: .byte 058; CHECK-NEXT: .ascii "/home/yhs/work/tests/llvm/bug/test.c" # string offset=2259; CHECK-NEXT: .byte 060 61; Function Attrs: nounwind readnone speculatable62declare void @llvm.dbg.declare(metadata, metadata, metadata)63 64; Function Attrs: argmemonly nounwind65declare void @llvm.lifetime.start.p0(i64, ptr nocapture)66 67; Function Attrs: argmemonly nounwind68declare void @llvm.lifetime.end.p0(i64, ptr nocapture)69 70; Function Attrs: nounwind readnone speculatable71declare void @llvm.dbg.value(metadata, metadata, metadata)72 73!llvm.dbg.cu = !{!0}74!llvm.module.flags = !{!3, !4, !5}75!llvm.ident = !{!6}76 77!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 8.0.20181009 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)78!1 = !DIFile(filename: "test.c", directory: "/home/yhs/work/tests/llvm/bug")79!2 = !{}80!3 = !{i32 2, !"Dwarf Version", i32 4}81!4 = !{i32 2, !"Debug Info Version", i32 3}82!5 = !{i32 1, !"wchar_size", i32 4}83!6 = !{!"clang version 8.0.20181009 "}84!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12)85!8 = !DISubroutineType(types: !9)86!9 = !{!10, !11}87!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)88!11 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)89!12 = !{!13, !14}90!13 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 1, type: !11)91!14 = !DILocalVariable(name: "b", scope: !7, file: !1, line: 1, type: !15)92!15 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !16)93!16 = !DIBasicType(name: "short", size: 16, encoding: DW_ATE_signed)94!17 = !DILocation(line: 1, column: 14, scope: !7)95!18 = !DILocation(line: 1, column: 19, scope: !7)96!19 = !DILocation(line: 1, column: 34, scope: !7)97!20 = !{!21, !21, i64 0}98!21 = !{!"short", !22, i64 0}99!22 = !{!"omnipotent char", !23, i64 0}100!23 = !{!"Simple C/C++ TBAA"}101!24 = !DILocation(line: 1, column: 49, scope: !7)102!25 = !DILocation(line: 1, column: 52, scope: !7)103!26 = !DILocation(line: 1, column: 42, scope: !7)104