re PR tree-optimization/91180 (wrong code at -O and above with __builtin_memset())

2019-07-17  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/91180
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Fix offset
	computation for memset partial defs.

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

From-SVN: r273548
This commit is contained in:
Richard Biener 2019-07-17 09:35:04 +00:00 committed by Richard Biener
parent 5d688cb277
commit 9505acd850
4 changed files with 25 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2019-07-17 Richard Biener <rguenther@suse.de>
PR tree-optimization/91180
* tree-ssa-sccvn.c (vn_reference_lookup_3): Fix offset
computation for memset partial defs.
2019-07-17 Jakub Jelinek <jakub@redhat.com>
* gimple.h (enum gf_mask): Remove GF_OMP_FOR_SIMD, change

View file

@ -1,3 +1,8 @@
2019-07-17 Richard Biener <rguenther@suse.de>
PR tree-optimization/91180
* gcc.dg/torture/pr91180.c: New testcase.
2019-07-17 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/91157

View file

@ -0,0 +1,13 @@
/* { dg-do run } */
int
main ()
{
#if __SIZEOF_INT__ == 4
unsigned x = 0xffffffff;
__builtin_memset (1 + (char *) &x, 0, 2);
if (x != 0xff0000ff)
__builtin_abort ();
#endif
return 0;
}

View file

@ -2486,7 +2486,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_,
{
pd_data pd;
pd.rhs = build_constructor (NULL_TREE, NULL);
pd.offset = offset2i - offseti;
pd.offset = (offset2i - offseti) / BITS_PER_UNIT;
pd.size = leni;
return data->push_partial_def (pd, vuse, maxsizei);
}