File: struct-arg.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (56 lines) | stat: -rw-r--r-- 1,997 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
; RUN: llc < %s -march=bpfel | FileCheck %s
; Source:
;   struct t1 {
;     long a;
;   };
;   struct t2 {
;     long a;
;     long b;
;   };
;   long foo2(struct t1 a1, struct t1 a2, struct t1 a3, struct t1 a4, struct t1 a5) {
;     return a1.a + a2.a + a3.a + a4.a + a5.a;
;   }
;   long foo3(struct t2 a1, struct t2 a2, struct t1 a3) {
;     return a1.a + a2.a + a3.a;
;   }
; Compilation flags:
;   clang -target bpf -S -emit-llvm -O2 t.c

; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
define dso_local i64 @foo2(i64 %a1.coerce, i64 %a2.coerce, i64 %a3.coerce, i64 %a4.coerce, i64 %a5.coerce) local_unnamed_addr #0 {
entry:
  %add = add nsw i64 %a2.coerce, %a1.coerce
  %add8 = add nsw i64 %add, %a3.coerce
  %add10 = add nsw i64 %add8, %a4.coerce
  %add12 = add nsw i64 %add10, %a5.coerce
  ret i64 %add12
; CHECK:        r0 = r2
; CHECK:        r0 += r1
; CHECK:        r0 += r3
; CHECK:        r0 += r4
; CHECK:        r0 += r5
; CHECK-NEXT:   exit
}

; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
define dso_local i64 @foo3([2 x i64] %a1.coerce, [2 x i64] %a2.coerce, i64 %a3.coerce) local_unnamed_addr #0 {
entry:
  %a1.coerce.fca.0.extract = extractvalue [2 x i64] %a1.coerce, 0
  %a2.coerce.fca.0.extract = extractvalue [2 x i64] %a2.coerce, 0
  %add = add nsw i64 %a2.coerce.fca.0.extract, %a1.coerce.fca.0.extract
  %add6 = add nsw i64 %add, %a3.coerce
  ret i64 %add6
; CHECK:        r0 = r3
; CHECK-NEXT:   r0 += r1
; CHECK-NEXT:   r0 += r5
; CHECK-NEXT:   exit
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind readnone willreturn "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }

!llvm.module.flags = !{!0, !1}
!llvm.ident = !{!2}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 7, !"frame-pointer", i32 2}
!2 = !{!"clang version 16.0.0 (https://github.com/llvm/llvm-project.git 9385660f4ca87d074410a84df89faca313afcb5a)"}