2019-08-18 06:12:00 +08:00
; RUN: llc -march=bpfel -filetype=obj -o - %s | llvm-objdump -S - | FileCheck %s
; RUN: llc -march=bpfeb -filetype=obj -o - %s | llvm-objdump -S - | FileCheck %s
;
; Source code:
; __attribute__((section("s1")))
; int func1(int a) {
; return a * a;
; }
; __attribute__((section("s2")))
; int func2(int a) {
; return a * a * a;
; }
; Compiler flag to generate IR:
; clang -target bpf -S -gdwarf-5 -gembed-source -emit-llvm -g -O2 bug.c
; Function Attrs: norecurse nounwind readnone
define d s o _ l o c a l i32 @func1 ( i32 %a ) local_unnamed_addr #0 section "s1" !dbg !7 {
entry:
2020-03-06 06:18:38 +08:00
; CHECK: <func1>:
2019-08-18 06:12:00 +08:00
call void @llvm.dbg.value ( metadata i32 %a , metadata !12 , metadata !DIExpression ( ) ) , !dbg !13
%mul = mul nsw i32 %a , %a , !dbg !14
ret i32 %mul , !dbg !15
; CHECK: ; return a * a;
}
; Function Attrs: norecurse nounwind readnone
define d s o _ l o c a l i32 @func2 ( i32 %a ) local_unnamed_addr #0 section "s2" !dbg !16 {
entry:
2020-03-06 06:18:38 +08:00
; CHECK: <func2>:
2019-08-18 06:12:00 +08:00
call void @llvm.dbg.value ( metadata i32 %a , metadata !18 , metadata !DIExpression ( ) ) , !dbg !19
%mul = mul nsw i32 %a , %a , !dbg !20
%mul1 = mul nsw i32 %mul , %a , !dbg !21
ret i32 %mul1 , !dbg !22
; CHECK: ; return a * a * a;
}
; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.value ( metadata , metadata , metadata ) #1
2019-12-25 07:52:21 +08:00
attributes #0 = { norecurse nounwind readnone "correctly-rounded-divide-sqrt-fp-math" = "false" "disable-tail-calls" = "false" "less-precise-fpmad" = "false" "min-legal-vector-width" = "0" "frame-pointer" = "all" "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" }
2019-08-18 06:12:00 +08:00
attributes #1 = { nounwind readnone s p e c u l a t a b l e }
!llvm.dbg.cu = ! { !0 }
!llvm.module.flags = ! { !3 , !4 , !5 }
!llvm.ident = ! { !6 }
!0 = distinct !DICompileUnit ( language: D W _ L A N G _ C 99 , file: !1 , producer: "clang version 9.0.0 (trunk 366422) (llvm/trunk 366423)" , isOptimized: true , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !2 , nameTableKind: N one )
!1 = !DIFile ( filename: "bug.c" , directory: "/tmp/home/yhs/work/tests/llvm/reloc" , checksumkind: C S K _ M D 5 , 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" )
!2 = ! { }
!3 = ! { i32 2 , !"Dwarf Version" , i32 5 }
!4 = ! { i32 2 , !"Debug Info Version" , i32 3 }
!5 = ! { i32 1 , !"wchar_size" , i32 4 }
!6 = ! { !"clang version 9.0.0 (trunk 366422) (llvm/trunk 366423)" }
!7 = distinct !DISubprogram ( name: "func1" , scope: !1 , file: !1 , line: 2 , type: !8 , scopeLine: 2 , flags: D I F l a g P r o t o t y p e d | D I F l a g A l l C a l l s D e s c r i b e d , spFlags: D I S P F l a g D e f i n i t i o n | D I S P F l a g O p t i m i z e d , unit: !0 , retainedNodes: !11 )
!8 = !DISubroutineType ( types: !9 )
!9 = ! { !10 , !10 }
!10 = !DIBasicType ( name: "int" , size: 32 , encoding: D W _ A T E _ s i g n e d )
!11 = ! { !12 }
!12 = !DILocalVariable ( name: "a" , arg: 1 , scope: !7 , file: !1 , line: 2 , type: !10 )
!13 = !DILocation ( line: 0 , scope: !7 )
!14 = !DILocation ( line: 3 , column: 14 , scope: !7 )
!15 = !DILocation ( line: 3 , column: 5 , scope: !7 )
!16 = distinct !DISubprogram ( name: "func2" , scope: !1 , file: !1 , line: 6 , type: !8 , scopeLine: 6 , flags: D I F l a g P r o t o t y p e d | D I F l a g A l l C a l l s D e s c r i b e d , spFlags: D I S P F l a g D e f i n i t i o n | D I S P F l a g O p t i m i z e d , unit: !0 , retainedNodes: !17 )
!17 = ! { !18 }
!18 = !DILocalVariable ( name: "a" , arg: 1 , scope: !16 , file: !1 , line: 6 , type: !10 )
!19 = !DILocation ( line: 0 , scope: !16 )
!20 = !DILocation ( line: 7 , column: 14 , scope: !16 )
!21 = !DILocation ( line: 7 , column: 18 , scope: !16 )
!22 = !DILocation ( line: 7 , column: 5 , scope: !16 )