aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-sra.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-11-08 11:58:45 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-11-08 11:58:45 +0000
commit93ace3af2c44fa019f5141243be198fb2233c7f8 (patch)
tree30b41e500b3c8d0bda47f2bd6a66bb0c8dd9ec78 /gcc/tree-sra.c
parentb602712b3ea2a0729a2eda61bd9ee795aba6138f (diff)
downloadgcc-93ace3af2c44fa019f5141243be198fb2233c7f8.zip
gcc-93ace3af2c44fa019f5141243be198fb2233c7f8.tar.gz
gcc-93ace3af2c44fa019f5141243be198fb2233c7f8.tar.bz2
Fix code order in tree-sra.c:create_access
If get_ref_base_and_extent returns poly_int offsets or sizes, tree-sra.c:create_access prevents SRA from being applied to the base. However, we haven't verified by that point that we have a valid base to disqualify. This originally led to an ICE on the attached testcase, but it no longer triggers there after the introduction of IPA SRA. 2019-11-08 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree-sra.c (create_access): Delay disqualifying the base for poly_int values until we know we have a base. gcc/testsuite/ * gcc.target/aarch64/sve/acle/general/inline_2.c: New test. From-SVN: r277965
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r--gcc/tree-sra.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 4486269..8bcfef4 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -789,19 +789,11 @@ create_access (tree expr, gimple *stmt, bool write)
{
struct access *access;
poly_int64 poffset, psize, pmax_size;
- HOST_WIDE_INT offset, size, max_size;
tree base = expr;
bool reverse, unscalarizable_region = false;
base = get_ref_base_and_extent (expr, &poffset, &psize, &pmax_size,
&reverse);
- if (!poffset.is_constant (&offset)
- || !psize.is_constant (&size)
- || !pmax_size.is_constant (&max_size))
- {
- disqualify_candidate (base, "Encountered a polynomial-sized access.");
- return NULL;
- }
/* For constant-pool entries, check we can substitute the constant value. */
if (constant_decl_p (base))
@@ -824,6 +816,15 @@ create_access (tree expr, gimple *stmt, bool write)
if (!DECL_P (base) || !bitmap_bit_p (candidate_bitmap, DECL_UID (base)))
return NULL;
+ HOST_WIDE_INT offset, size, max_size;
+ if (!poffset.is_constant (&offset)
+ || !psize.is_constant (&size)
+ || !pmax_size.is_constant (&max_size))
+ {
+ disqualify_candidate (base, "Encountered a polynomial-sized access.");
+ return NULL;
+ }
+
if (size != max_size)
{
size = max_size;