
Summary: Byval requires allocating additional stack space, and always requires an implicit copy to be inserted in codegen, where it can be difficult to optimize. In this work, we use byref/IndirectAliased promotion method instead of byval with the implicit copy semantics. Reviewers: arsenm Differential Revision: https://reviews.llvm.org/D155986
18 lines
540 B
Common Lisp
18 lines
540 B
Common Lisp
// RUN: %clang_cc1 -emit-llvm -o - -triple i686-pc-darwin %s | FileCheck -check-prefix=X86 %s
|
|
// RUN: %clang_cc1 -emit-llvm -o - -triple amdgcn %s | FileCheck -check-prefix=AMDGCN %s
|
|
struct A {
|
|
int x[100];
|
|
};
|
|
|
|
int f(struct A a);
|
|
|
|
int g() {
|
|
struct A a;
|
|
// X86: call i32 @f(ptr noundef nonnull byval(%struct.A) align 4 %a)
|
|
// AMDGCN: call i32 @f(ptr addrspace(5) noundef byref{{.*}}%a)
|
|
return f(a);
|
|
}
|
|
|
|
// X86: declare i32 @f(ptr noundef byval(%struct.A) align 4)
|
|
// AMDGCN: declare i32 @f(ptr addrspace(5) noundef byref{{.*}})
|