Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[COFF, ARM64] Decide when to mark struct returns as SRet
Summary: Refer the MS ARM64 ABI Convention for the behavior for struct returns: https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions#return-values Reviewers: mstorsjo, compnerd, rnk, javed.absar, yinma, efriedma Reviewed By: rnk, efriedma Subscribers: haripul, TomTan, yinma, efriedma, kristof.beyls, chrib, llvm-commits Differential Revision: https://reviews.llvm.org/D49464 llvm-svn: 338050
- Loading branch information
Mandeep Singh Grang
committed
Jul 26, 2018
1 parent
3bdd600
commit 2a15310
Showing
4 changed files
with
53 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// RUN: %clang_cc1 -triple aarch64-windows -ffreestanding -emit-llvm -O0 \ | ||
// RUN: -x c++ -o - %s | FileCheck %s | ||
|
||
struct pod { int a, b, c, d, e; }; | ||
|
||
struct non_pod { | ||
int a; | ||
non_pod() {} | ||
}; | ||
|
||
struct pod s; | ||
struct non_pod t; | ||
|
||
struct pod bar() { return s; } | ||
struct non_pod foo() { return t; } | ||
// CHECK: define {{.*}} void @{{.*}}bar{{.*}}(%struct.pod* noalias sret %agg.result) | ||
// CHECK: define {{.*}} void @{{.*}}foo{{.*}}(%struct.non_pod* noalias %agg.result) | ||
|
||
|
||
// Check instance methods. | ||
struct pod2 { int x; }; | ||
struct Baz { pod2 baz(); }; | ||
|
||
int qux() { return Baz().baz().x; } | ||
// CHECK: declare {{.*}} void @{{.*}}baz@Baz{{.*}}(%struct.Baz*, %struct.pod2*) |