| 1 |
// REQUIRES: bpf-registered-target |
| 2 |
// RUN: %clang_cc1 -triple bpf -O2 -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s |
| 3 |
|
| 4 |
struct t1 {}; |
| 5 |
struct t2 { |
| 6 |
int a; |
| 7 |
}; |
| 8 |
struct t3 { |
| 9 |
int a; |
| 10 |
long b; |
| 11 |
}; |
| 12 |
struct t4 { |
| 13 |
long a; |
| 14 |
long b; |
| 15 |
long c; |
| 16 |
}; |
| 17 |
|
| 18 |
int foo1(struct t1 arg1, struct t2 arg2) { |
| 19 |
// CHECK: define dso_local i32 @foo1(i32 %arg2.coerce) |
| 20 |
return arg2.a; |
| 21 |
} |
| 22 |
|
| 23 |
int foo2(struct t3 arg1, struct t4 arg2) { |
| 24 |
// CHECK: define dso_local i32 @foo2([2 x i64] %arg1.coerce, ptr noundef byval(%struct.t4) align 8 %arg2) |
| 25 |
return arg1.a + arg2.a; |
| 26 |
} |
| 27 |
|
| 28 |
int foo3(void) { |
| 29 |
struct t1 tmp1 = {}; |
| 30 |
struct t2 tmp2 = {}; |
| 31 |
struct t3 tmp3 = {}; |
| 32 |
struct t4 tmp4 = {}; |
| 33 |
return foo1(tmp1, tmp2) + foo2(tmp3, tmp4); |
| 34 |
// CHECK: call i32 @foo1(i32 %{{[a-zA-Z0-9]+}}) |
| 35 |
// CHECK: call i32 @foo2([2 x i64] %{{[a-zA-Z0-9]+}}, ptr noundef byval(%struct.t4) align 8 %tmp4) |
| 36 |
} |