diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2020-01-15 16:52:18 +0000 |
---|---|---|
committer | Richard Sandiford <richard.sandiford@arm.com> | 2020-01-17 09:20:24 +0000 |
commit | 507de5ee23efdc8a16d6b0b6488e118055c711cd (patch) | |
tree | e7235c4e9347a06ba96dddc8c2eac472a2f51d0d /gcc | |
parent | e4a5f73449d7352ba8128fecbc9a9570d746abdb (diff) | |
download | gcc-507de5ee23efdc8a16d6b0b6488e118055c711cd.zip gcc-507de5ee23efdc8a16d6b0b6488e118055c711cd.tar.gz gcc-507de5ee23efdc8a16d6b0b6488e118055c711cd.tar.bz2 |
gimplifier: handle POLY_INT_CST-sized TARGET_EXPRs
If a TARGET_EXPR has poly-int size, the gimplifier would treat it
like a VLA and use gimplify_vla_decl. gimplify_vla_decl in turn
would use an alloca and expect all references to be gimplified
via the DECL_VALUE_EXPR. This caused confusion later in
gimplify_var_or_parm_decl_1 when we (correctly) had direct rather
than indirect references.
For completeness, the patch also fixes similar tests in the RETURN_EXPR
handling and OpenMP depend clauses.
2020-01-17 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* gimplify.c (gimplify_return_expr): Use poly_int_tree_p rather
than testing directly for INTEGER_CST.
(gimplify_target_expr, gimplify_omp_depend): Likewise.
gcc/testsuite/
* g++.target/aarch64/sve/acle/general-c++/gimplify_1.C: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/gimplify.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gimplify_1.C | 4 |
4 files changed, 17 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d8c34b2..423899d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-01-17 Richard Sandiford <richard.sandiford@arm.com> + + * gimplify.c (gimplify_return_expr): Use poly_int_tree_p rather + than testing directly for INTEGER_CST. + (gimplify_target_expr, gimplify_omp_depend): Likewise. + 2020-01-17 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/93292 diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 05d7922..e50be57 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1632,7 +1632,7 @@ gimplify_return_expr (tree stmt, gimple_seq *pre_p) result = NULL_TREE; else if (aggregate_value_p (result_decl, TREE_TYPE (current_function_decl))) { - if (TREE_CODE (DECL_SIZE (result_decl)) != INTEGER_CST) + if (!poly_int_tree_p (DECL_SIZE (result_decl))) { if (!TYPE_SIZES_GIMPLIFIED (TREE_TYPE (result_decl))) gimplify_type_sizes (TREE_TYPE (result_decl), pre_p); @@ -6714,7 +6714,7 @@ gimplify_target_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) /* TARGET_EXPR temps aren't part of the enclosing block, so add it to the temps list. Handle also variable length TARGET_EXPRs. */ - if (TREE_CODE (DECL_SIZE (temp)) != INTEGER_CST) + if (!poly_int_tree_p (DECL_SIZE (temp))) { if (!TYPE_SIZES_GIMPLIFIED (TREE_TYPE (temp))) gimplify_type_sizes (TREE_TYPE (temp), pre_p); @@ -7921,7 +7921,7 @@ gimplify_omp_depend (tree *list_p, gimple_seq *pre_p) tree type = build_array_type (ptr_type_node, build_index_type (totalpx)); tree array = create_tmp_var_raw (type); TREE_ADDRESSABLE (array) = 1; - if (TREE_CODE (totalpx) != INTEGER_CST) + if (!poly_int_tree_p (totalpx)) { if (!TYPE_SIZES_GIMPLIFIED (TREE_TYPE (array))) gimplify_type_sizes (TREE_TYPE (array), pre_p); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4247302..a4290ee 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2020-01-17 Richard Sandiford <richard.sandiford@arm.com> + + * g++.target/aarch64/sve/acle/general-c++/gimplify_1.C: New test. + 2020-01-17 Mark Eggleston <mark.eggleston@codethink.com> Tobias Burnus <burnus@gcc.gnu.org> diff --git a/gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gimplify_1.C b/gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gimplify_1.C new file mode 100644 index 0000000..06ee7ea --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gimplify_1.C @@ -0,0 +1,4 @@ +/* { dg-additional-options "-flax-vector-conversions" } */ + +inline void foo (const __SVInt32_t &foo) {} +void bar (__SVUint32_t x) { foo(x); } |