diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2018-02-28 20:16:12 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2018-02-28 20:16:12 +0000 |
commit | f181f1a6a206f427860e999768259e81a94f6d6a (patch) | |
tree | 4ebd366f7f0762e9eccd0fa51188f0a9e8220287 | |
parent | b95298b041c4adc5df405f9549b7aef46948915f (diff) | |
download | bcm5719-llvm-f181f1a6a206f427860e999768259e81a94f6d6a.tar.gz bcm5719-llvm-f181f1a6a206f427860e999768259e81a94f6d6a.zip |
CodeGenObjCXX: handle inalloca appropriately for msgSend variant
objc_msgSend_stret takes a hidden parameter for the returned structure's
address for the construction. When the function signature is rewritten
for the inalloca passing, the return type is no longer marked as
indirect but rather inalloca stret. This enhances the test for the
indirect return to check for that case as well. This fixes the
incorrect return classification for Windows x86.
llvm-svn: 326362
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 3 | ||||
-rw-r--r-- | clang/test/CodeGenObjCXX/msabi-stret.mm | 18 |
2 files changed, 20 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 1d346935de1..d1b07f86819 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -1479,7 +1479,8 @@ void ClangToLLVMArgMapping::construct(const ASTContext &Context, /***/ bool CodeGenModule::ReturnTypeUsesSRet(const CGFunctionInfo &FI) { - return FI.getReturnInfo().isIndirect(); + const auto &RI = FI.getReturnInfo(); + return RI.isIndirect() || (RI.isInAlloca() && RI.getInAllocaSRet()); } bool CodeGenModule::ReturnSlotInterferesWithArgs(const CGFunctionInfo &FI) { diff --git a/clang/test/CodeGenObjCXX/msabi-stret.mm b/clang/test/CodeGenObjCXX/msabi-stret.mm new file mode 100644 index 00000000000..765c23887ba --- /dev/null +++ b/clang/test/CodeGenObjCXX/msabi-stret.mm @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -triple i686-unknown-windows-msvc -fobjc-runtime=ios-6.0 -Os -S -emit-llvm -o - %s -mdisable-fp-elim | FileCheck %s + +struct S { + S() = default; + S(const S &) {} +}; + +@interface I ++ (S)m:(S)s; +@end + +S f() { + return [I m:S()]; +} + +// CHECK: declare dllimport void @objc_msgSend_stret(i8*, i8*, ...) +// CHECK-NOT: declare dllimport void @objc_msgSend(i8*, i8*, ...) + |