From be5f7eccf766a4c3a59b821f77ce320001df838f Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 8 Nov 2019 09:06:50 +0000 Subject: [PATCH] Handle POLY_INT_CSTs in declare_return_value SVE allows variable-length vectors to be returned by value, which tripped the assert in declare_return_variable. 2019-11-08 Richard Sandiford 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. From-SVN: r277956 --- gcc/ChangeLog | 5 +++++ gcc/testsuite/ChangeLog | 4 ++++ .../gcc.target/aarch64/sve/acle/general/inline_1.c | 6 ++++++ gcc/tree-inline.c | 4 ++-- 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/inline_1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4b1f408d851..b50456e74fc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-11-08 Richard Sandiford + + * tree-inline.c (declare_return_variable): Check for poly_int_tree_p + instead of INTEGER_CST. + 2019-11-08 Richard Biener PR tree-optimization/92324 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 358bbf5eb34..9d5702b1c27 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-11-08 Richard Sandiford + + * gcc.target/aarch64/sve/acle/general/inline_1.c: New test. + 2019-11-08 Richard Biener PR tree-optimization/92324 diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/inline_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/inline_1.c new file mode 100644 index 00000000000..f736ac3f082 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/inline_1.c @@ -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); } diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 2b8b9ee58c1..9d0acd97f77 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -3654,7 +3654,7 @@ declare_return_variable (copy_body_data *id, tree return_slot, tree modify_dest, /* ??? 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 *id, tree return_slot, tree modify_dest, } } - 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;