[committed] Handle POLY_INT_CSTs in declare_return_value
diff mbox series

Message ID mptr22iloou.fsf@arm.com
State New
Headers show
Series
  • [committed] Handle POLY_INT_CSTs in declare_return_value
Related show

Commit Message

Richard Sandiford Nov. 8, 2019, 9:09 a.m. UTC
SVE allows variable-length vectors to be returned by value,
which tripped the assert in declare_return_variable.

Tested on aarch64-linux-gnu and x86_64-linux-gnu.  Applied as obvious/
preapproved by Jeff some time ago for this kind of change.

Richard


2019-11-08  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-inline.c (declare_return_variable): Check for poly_int_tree_p
	instead of INTEGER_CST.

gcc/testsuite/
	* gcc.target/aarch64/sve/acle/general/inline_1.c: New test.

Patch
diff mbox series

Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c	2019-10-31 17:15:25.110519870 +0000
+++ gcc/tree-inline.c	2019-11-08 09:06:22.762944419 +0000
@@ -3654,7 +3654,7 @@  declare_return_variable (copy_body_data
       /* ??? If we're assigning to a variable sized type, then we must
 	 reuse the destination variable, because we've no good way to
 	 create variable sized temporaries at this point.  */
-      else if (TREE_CODE (TYPE_SIZE_UNIT (caller_type)) != INTEGER_CST)
+      else if (!poly_int_tree_p (TYPE_SIZE_UNIT (caller_type)))
 	use_it = true;
 
       /* If the callee cannot possibly modify MODIFY_DEST, then we can
@@ -3689,7 +3689,7 @@  declare_return_variable (copy_body_data
 	}
     }
 
-  gcc_assert (TREE_CODE (TYPE_SIZE_UNIT (callee_type)) == INTEGER_CST);
+  gcc_assert (poly_int_tree_p (TYPE_SIZE_UNIT (callee_type)));
 
   var = copy_result_decl_to_var (result, id);
   DECL_SEEN_IN_BIND_EXPR_P (var) = 1;
Index: gcc/testsuite/gcc.target/aarch64/sve/acle/general/inline_1.c
===================================================================
--- /dev/null	2019-09-17 11:41:18.176664108 +0100
+++ gcc/testsuite/gcc.target/aarch64/sve/acle/general/inline_1.c	2019-11-08 09:06:22.758944447 +0000
@@ -0,0 +1,6 @@ 
+/* { dg-options "-O2" } */
+
+#pragma GCC aarch64 "arm_sve.h"
+
+static inline svint32_t foo () { return svdup_s32 (32); }
+svint32_t bar () { return svadd_x (svptrue_b8 (), foo (), 1); }