[PATCH] D53919: [X86] Don't allow illegal vector types to return by direct value.

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 30 21:52:17 PDT 2018


craig.topper created this revision.
craig.topper added reviewers: efriedma, rnk, echristo.

The backend can't lower this correctly and will try to split the return value into multiple registers.

This patches forces it to return via memory similar to what was already done for arguments.

Fixes PR39501.


Repository:
  rC Clang

https://reviews.llvm.org/D53919

Files:
  lib/CodeGen/TargetInfo.cpp
  test/CodeGen/x86_64-arguments.c


Index: test/CodeGen/x86_64-arguments.c
===================================================================
--- test/CodeGen/x86_64-arguments.c
+++ test/CodeGen/x86_64-arguments.c
@@ -545,3 +545,13 @@
 // AVX: @f65(<8 x float> %{{[^,)]+}})
 void f65(struct t65 a0) {
 }
+
+// SSE-LABEL: @f66(<32 x i8>* noalias sret %{{[^,)]+}})
+// AVX: <32 x i8> @f66()
+typedef char v66 __attribute__((vector_size (32))) ;
+v66 f66()
+{
+ v66 y = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f',
+          '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
+ return y;
+}
Index: lib/CodeGen/TargetInfo.cpp
===================================================================
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -2859,7 +2859,7 @@
 ABIArgInfo X86_64ABIInfo::getIndirectReturnResult(QualType Ty) const {
   // If this is a scalar LLVM value then assume LLVM will pass it in the right
   // place naturally.
-  if (!isAggregateTypeForABI(Ty)) {
+  if (!isAggregateTypeForABI(Ty) && !IsIllegalVectorType(Ty)) {
     // Treat an enum type as its underlying type.
     if (const EnumType *EnumTy = Ty->getAs<EnumType>())
       Ty = EnumTy->getDecl()->getIntegerType();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53919.171861.patch
Type: text/x-patch
Size: 1210 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181031/8a54809f/attachment.bin>


More information about the cfe-commits mailing list