summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2018-02-28 20:16:12 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2018-02-28 20:16:12 +0000
commitf181f1a6a206f427860e999768259e81a94f6d6a (patch)
tree4ebd366f7f0762e9eccd0fa51188f0a9e8220287
parentb95298b041c4adc5df405f9549b7aef46948915f (diff)
downloadbcm5719-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.cpp3
-rw-r--r--clang/test/CodeGenObjCXX/msabi-stret.mm18
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*, ...)
+
OpenPOWER on IntegriCloud