re PR tree-optimization/79351 (Invalid tree PRE optimization around compound literal)

2018-11-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/79351
	* tree-ssa-sccvn.c (vn_reference_lookup_3): For assignments from
	empty CONSTRUCTORs ensure the store is at a constant position.

	* gcc.dg/torture/pr79351.c: New testcase.

From-SVN: r266551
This commit is contained in:
Richard Biener 2018-11-28 11:01:06 +00:00 committed by Richard Biener
parent 80e6a1edf9
commit aa2e903e1d
4 changed files with 39 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2018-11-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/79351
* tree-ssa-sccvn.c (vn_reference_lookup_3): For assignments from
empty CONSTRUCTORs ensure the store is at a constant position.
2018-11-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/88229

View file

@ -1,3 +1,8 @@
2018-11-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/79351
* gcc.dg/torture/pr79351.c: New testcase.
2018-11-28 Jakub Jelinek <jakub@redhat.com>
PR target/88189
@ -13,7 +18,7 @@
PR c++/88215
* c-c++-common/ubsan/pr88215.c: New test.
2018-10-19 Richard Biener <rguenther@suse.de>
2018-11-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/88182
* g++.dg/gomp/pr88182.C: Move from libgomp and use -fopenmp-simd.

View file

@ -0,0 +1,26 @@
/* { dg-do run } */
static struct state {
int k;
int dummy;
} states[256];
__attribute((noipa))
static void
ismatch(int n)
{
for (int j=0; j<n; j++) {
states[j] = (struct state){0};
for (int i = 0; i <= j; i++) {
states[i].k++;
}
}
}
int
main()
{
ismatch(2);
if (states[0].k != 2)
__builtin_abort();
}

View file

@ -2115,6 +2115,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_,
base2 = get_ref_base_and_extent (gimple_assign_lhs (def_stmt),
&offset2, &size2, &maxsize2, &reverse);
if (known_size_p (maxsize2)
&& known_eq (maxsize2, size2)
&& operand_equal_p (base, base2, 0)
&& known_subrange_p (offset, maxsize, offset2, size2))
{