28 lines · c
1// RUN: %clang_cc1 -triple mips64-linux-gnu -o - -emit-llvm %s | FileCheck %s2//3// Transparent unions are passed according to the calling convention rules of4// the first member. In this case, it is as if it were a void pointer so we5// 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 N328// case where pointers are promoted to i64 and a non-transparent union would be9// passed in the upper 32-bits of an i64.10 11union either_pointer {12 void *void_ptr;13 int *int_ptr;14} __attribute__((transparent_union));15 16extern void foo(union either_pointer p);17 18int data;19 20void bar(void) {21 return foo(&data);22}23 24// CHECK-LABEL: define{{.*}} void @bar()25// CHECK: call void @foo(ptr %{{[0-9]+}})26 27// CHECK: declare void @foo(ptr)28