brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · 8158a1b Raw
67 lines · plain
1; RUN: llc -mtriple=bpfel -filetype=obj -o - %s | llvm-objdump -S - | FileCheck %s2; RUN: llc -mtriple=bpfeb -filetype=obj -o - %s | llvm-objdump -S - | FileCheck %s3;4; Source code:5;   __attribute__((section("s1")))6;   int func1(int a) {7;       return a * a;8;   }9;   __attribute__((section("s2")))10;   int func2(int a) {11;       return a * a * a;12;   }13; Compiler flag to generate IR:14;   clang -target bpf -S -gdwarf-5 -gembed-source -emit-llvm -g -O2 bug.c15 16; Function Attrs: norecurse nounwind readnone17define dso_local i32 @func1(i32 %a) local_unnamed_addr section "s1" !dbg !7 {18entry:19; CHECK: <func1>:20  call void @llvm.dbg.value(metadata i32 %a, metadata !12, metadata !DIExpression()), !dbg !1321  %mul = mul nsw i32 %a, %a, !dbg !1422  ret i32 %mul, !dbg !1523; CHECK: ; return a * a;24}25 26; Function Attrs: norecurse nounwind readnone27define dso_local i32 @func2(i32 %a) local_unnamed_addr section "s2" !dbg !16 {28entry:29; CHECK: <func2>:30  call void @llvm.dbg.value(metadata i32 %a, metadata !18, metadata !DIExpression()), !dbg !1931  %mul = mul nsw i32 %a, %a, !dbg !2032  %mul1 = mul nsw i32 %mul, %a, !dbg !2133  ret i32 %mul1, !dbg !2234; CHECK: ; return a * a * a;35}36 37; Function Attrs: nounwind readnone speculatable38declare void @llvm.dbg.value(metadata, metadata, metadata)39 40!llvm.dbg.cu = !{!0}41!llvm.module.flags = !{!3, !4, !5}42!llvm.ident = !{!6}43 44!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 9.0.0 (trunk 366422) (llvm/trunk 366423)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)45!1 = !DIFile(filename: "bug.c", directory: "/tmp/home/yhs/work/tests/llvm/reloc", checksumkind: CSK_MD5, checksum: "c7c9938d4e6989ca33db748213aab194", source: "__attribute__((section(\22s1\22)))\0Aint func1(int a) {\0A    return a * a;\0A}\0A__attribute__((section(\22s2\22)))\0Aint func2(int a) {\0A    return a * a * a;\0A}\0A")46!2 = !{}47!3 = !{i32 2, !"Dwarf Version", i32 5}48!4 = !{i32 2, !"Debug Info Version", i32 3}49!5 = !{i32 1, !"wchar_size", i32 4}50!6 = !{!"clang version 9.0.0 (trunk 366422) (llvm/trunk 366423)"}51!7 = distinct !DISubprogram(name: "func1", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)52!8 = !DISubroutineType(types: !9)53!9 = !{!10, !10}54!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)55!11 = !{!12}56!12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10)57!13 = !DILocation(line: 0, scope: !7)58!14 = !DILocation(line: 3, column: 14, scope: !7)59!15 = !DILocation(line: 3, column: 5, scope: !7)60!16 = distinct !DISubprogram(name: "func2", scope: !1, file: !1, line: 6, type: !8, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !17)61!17 = !{!18}62!18 = !DILocalVariable(name: "a", arg: 1, scope: !16, file: !1, line: 6, type: !10)63!19 = !DILocation(line: 0, scope: !16)64!20 = !DILocation(line: 7, column: 14, scope: !16)65!21 = !DILocation(line: 7, column: 18, scope: !16)66!22 = !DILocation(line: 7, column: 5, scope: !16)67