Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / bpf-union-argument.c
blob5f3a0bc5a92615b9b632b48406739af5428643a7
1 // REQUIRES: bpf-registered-target
2 // RUN: %clang_cc1 -triple bpf -O2 -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s
4 union t1 {};
5 union t2 {
6 int a;
7 long b;
8 };
9 union t3 {
10 struct {
11 int a;
12 long b;
14 long c;
16 union t4 {
17 struct {
18 long a;
19 long b;
20 long c;
22 long d;
25 int foo1(union t1 arg1, union t2 arg2) {
26 // CHECK: define dso_local i32 @foo1(i64 %arg2.coerce)
27 return arg2.a;
30 int foo2(union t3 arg1, union t4 arg2) {
31 // CHECK: define dso_local i32 @foo2([2 x i64] %arg1.coerce, ptr noundef byval(%union.t4) align 8 %arg2)
32 return arg1.a + arg2.a;
36 int foo3(void) {
37 union t1 tmp1 = {};
38 union t2 tmp2 = {};
39 union t3 tmp3 = {};
40 union t4 tmp4 = {};
41 return foo1(tmp1, tmp2) + foo2(tmp3, tmp4);
42 // CHECK: call i32 @foo1(i64 %{{[a-zA-Z0-9]+}})
43 // CHECK: call i32 @foo2([2 x i64] %{{[a-zA-Z0-9]+}}, ptr noundef byval(%union.t4) align 8 %tmp4)