Commit 75fad0a9 by Richard Biener Committed by Richard Biener

re PR tree-optimization/91091 ([missed optimization] Missing optimization in unaliased pointers)

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

	PR tree-optimization/91091
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Overlap of
	accesses can happen with -fno-strict-aliasing.

	* gcc.dg/tree-ssa/pr91091-1.c: New testcase.
	* gcc.dg/tree-ssa/ssa-fre-61.c: Adjust.

From-SVN: r273134
parent 1d776353
2019-07-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/91091
* tree-ssa-sccvn.c (vn_reference_lookup_3): Overlap of
accesses can happen with -fno-strict-aliasing.
2019-07-05 Jan Hubicka <hubicka@ucw.cz> 2019-07-05 Jan Hubicka <hubicka@ucw.cz>
* tree-ssa-alias.c (alias_stats): Add * tree-ssa-alias.c (alias_stats): Add
......
2019-07-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/91091
* gcc.dg/tree-ssa/pr91091-1.c: New testcase.
* gcc.dg/tree-ssa/ssa-fre-61.c: Adjust.
2019-07-05 Eric Botcazou <ebotcazou@adacore.com> 2019-07-05 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/pack23.adb, gnat.dg/pack23_pkg.ads: New testcase. * gnat.dg/pack23.adb, gnat.dg/pack23_pkg.ads: New testcase.
......
/* { dg-do run } */
/* { dg-options "-O3 -fno-strict-aliasing" } */
struct s { int x; } __attribute__((packed));
struct t { int x; };
void __attribute__((noinline,noipa))
swap(struct s* p, struct t* q)
{
p->x = q->x;
q->x = p->x;
}
int main()
{
struct t a[2];
a[0].x = 0x12345678;
a[1].x = 0x98765432;
swap ((struct s *)((char *)a + 1), a);
if (a[0].x != 0x12345678)
__builtin_abort ();
return 0;
}
/* { dg-do link } */ /* { dg-do link } */
/* { dg-options "-O -fdump-tree-fre1-details" } */ /* { dg-options "-O -fstrict-aliasing -fdump-tree-fre1-details" } */
void link_error (void); void link_error (void);
......
...@@ -1996,7 +1996,8 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, ...@@ -1996,7 +1996,8 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_,
activation of a union member via a store makes the activation of a union member via a store makes the
values of untouched bytes unspecified. */ values of untouched bytes unspecified. */
&& (known_eq (ref->size, BITS_PER_UNIT) && (known_eq (ref->size, BITS_PER_UNIT)
|| (get_alias_set (lhs) != 0 || (flag_strict_aliasing
&& get_alias_set (lhs) != 0
&& ao_ref_alias_set (ref) != 0))) && ao_ref_alias_set (ref) != 0)))
{ {
tree *saved_last_vuse_ptr = data->last_vuse_ptr; tree *saved_last_vuse_ptr = data->last_vuse_ptr;
......
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