Commit bd87b1fd by Martin Jambor

sra: Fix access verification (PR 94598)

get_ref_base_and_extent recognizes ARRAY_REFs with variable index but
into arrays of length one as constant offset accesses.  However,
max_size in such cases is extended to span the whole element.  This
confuses SRA verification when SRA also builds its (total
scalarization) access structures to describe fields under such array -
get_ref_base_and_extent returns different size and max_size for them.

Fixed by not performing the check for total scalarization accesses.
The subsequent check then had to be changed to use size and not
max_size too, which meant it has to be skipped when the access
structure describes a genuine variable array access.

Bootstrapped and tested on x86_64-linux.

2020-04-16  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/94598
	* tree-sra.c (verify_sra_access_forest): Fix verification of total
	scalarization accesses under access to one-element arrays.

	testsuite/
	* gcc.dg/tree-ssa/pr94598.c: New test.
parent 9303fe07
2020-04-16 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/94598
* tree-sra.c (verify_sra_access_forest): Fix verification of total
scalarization accesses under access to one-element arrays.
2020-04-16 Jakub Jelinek <jakub@redhat.com> 2020-04-16 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/89494 PR bootstrap/89494
......
2020-04-16 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/94598
* gcc.dg/tree-ssa/pr94598.c: New test.
2020-04-16 Jakub Jelinek <jakub@redhat.com> 2020-04-16 Jakub Jelinek <jakub@redhat.com>
PR ipa/92372 PR ipa/92372
......
/* { dg-do compile } */
/* { dg-options "-O1" } */
struct a {
int b;
short c;
};
int d;
void e() {
struct a f[1];
f[d] = f[d];
}
struct S {
int a[30];
int c;
};
int get_int (void);
int foo(struct S p)
{
p.c = get_int ();
p.a[get_int()] = get_int()+1;
return p.c;
}
...@@ -2357,9 +2357,11 @@ verify_sra_access_forest (struct access *root) ...@@ -2357,9 +2357,11 @@ verify_sra_access_forest (struct access *root)
gcc_assert (base == first_base); gcc_assert (base == first_base);
gcc_assert (offset == access->offset); gcc_assert (offset == access->offset);
gcc_assert (access->grp_unscalarizable_region gcc_assert (access->grp_unscalarizable_region
|| access->grp_total_scalarization
|| size == max_size); || size == max_size);
gcc_assert (!is_gimple_reg_type (access->type) gcc_assert (access->grp_unscalarizable_region
|| max_size == access->size); || !is_gimple_reg_type (access->type)
|| size == access->size);
gcc_assert (reverse == access->reverse); gcc_assert (reverse == access->reverse);
if (access->first_child) if (access->first_child)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment