Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / mips-transparent-union.c
blob555dbbf084808e0c5765adeecd9bd91a435d0f7d
1 // RUN: %clang_cc1 -triple mips64-linux-gnu -o - -emit-llvm %s | FileCheck %s
2 //
3 // Transparent unions are passed according to the calling convention rules of
4 // the first member. In this case, it is as if it were a void pointer so we
5 // do not have the inreg attribute we would normally have for unions.
6 //
7 // This comes up in glibc's wait() function and matters for the big-endian N32
8 // case where pointers are promoted to i64 and a non-transparent union would be
9 // passed in the upper 32-bits of an i64.
11 union either_pointer {
12 void *void_ptr;
13 int *int_ptr;
14 } __attribute__((transparent_union));
16 extern void foo(union either_pointer p);
18 int data;
20 void bar(void) {
21 return foo(&data);
24 // CHECK-LABEL: define{{.*}} void @bar()
25 // CHECK: call void @foo(ptr %{{[0-9]+}})
27 // CHECK: declare void @foo(ptr)