Author: compnerd
Date: Wed Feb 28 12:16:12 2018
New Revision: 326362
URL: http://llvm.org/viewvc/llvm-project?rev=326362&view=rev
Log:
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.
Added:
cfe/trunk/test/CodeGenObjCXX/msabi-stret.mm
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=326362&r1=326361&r2=326362&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Wed Feb 28 12:16:12 2018
@@ -1479,7 +1479,8 @@ void ClangToLLVMArgMapping::construct(co
/***/
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) {
Added: cfe/trunk/test/CodeGenObjCXX/msabi-stret.mm
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/msabi-stret.mm?rev=326362&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/msabi-stret.mm (added)
+++ cfe/trunk/test/CodeGenObjCXX/msabi-stret.mm Wed Feb 28 12:16:12 2018
@@ -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*, ...)
+
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits