[Bug c++/91445] [9 Regression] After memset, logical && operator produces false result, optimization level >=O1

2019-08-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91445

Richard Biener  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
  Known to work||9.2.1
 Resolution|--- |FIXED

--- Comment #10 from Richard Biener  ---
Fixed.

[Bug c++/91445] [9 Regression] After memset, logical && operator produces false result, optimization level >=O1

2019-08-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91445

--- Comment #11 from Richard Biener  ---
Author: rguenth
Date: Thu Aug 15 12:05:31 2019
New Revision: 274533

URL: https://gcc.gnu.org/viewcvs?rev=274533=gcc=rev
Log:
2019-08-15  Richard Biener  

PR tree-optimization/91445
* gcc.dg/torture/pr91445.c: New testcase.

Added:
trunk/gcc/testsuite/gcc.dg/torture/pr91445.c
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug c++/91445] [9 Regression] After memset, logical && operator produces false result, optimization level >=O1

2019-08-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91445

--- Comment #9 from Richard Biener  ---
Author: rguenth
Date: Thu Aug 15 12:02:47 2019
New Revision: 274532

URL: https://gcc.gnu.org/viewcvs?rev=274532=gcc=rev
Log:
2019-08-15  Richard Biener  

PR tree-optimization/91445
* gcc.dg/torture/pr91445.c: New testcase.

Backport from mainline
2019-07-05  Richard Biener  

PR tree-optimization/91091
* tree-ssa-alias.h (get_continuation_for_phi): Add tbaa_p parameter.
(walk_non_aliased_vuses): Likewise.
* tree-ssa-alias.c (maybe_skip_until): Pass down tbaa_p.
(get_continuation_for_phi): New tbaa_p parameter and pass
it down.
(walk_non_aliased_vuses): Likewise.
* tree-ssa-pre.c (translate_vuse_through_block): Likewise.
* tree-ssa-scopedtables.c (avail_exprs_stack::lookup_avail_expr):
Likewise.
* tree-ssa-sccvn.c (struct vn_walk_cb_data): Add tbaa_p flag.
(vn_reference_lookup_3): Handle and pass down tbaa_p flag.
(vn_reference_lookup_pieces): Adjust.
(vn_reference_lookup): Remove alias-set altering, instead pass
down false as tbaa_p.

* gcc.dg/tree-ssa/pr91091-2.c: New testcase.

2019-07-04  Richard Biener  

* tree-ssa-sccvn.h (vn_reference_lookup): Add last_vuse_ptr
argument.
* tree-ssa-sccvn.c (last_vuse_ptr, vn_walk_kind): Move
globals into...
(struct vn_walk_cb_data): New callback data struct.
(vn_reference_lookup_2): Adjust.
(vn_reference_lookup_3): Likewise.
(vn_reference_lookup_pieces): Likewise.
(vn_reference_lookup): Likewise, get last_vuse_ptr argument.
(visit_reference_op_load): Adjust.

Added:
branches/gcc-9-branch/gcc/testsuite/gcc.dg/torture/pr91445.c
branches/gcc-9-branch/gcc/testsuite/gcc.dg/tree-ssa/pr91091-2.c
Modified:
branches/gcc-9-branch/gcc/ChangeLog
branches/gcc-9-branch/gcc/testsuite/ChangeLog
branches/gcc-9-branch/gcc/tree-ssa-alias.c
branches/gcc-9-branch/gcc/tree-ssa-alias.h
branches/gcc-9-branch/gcc/tree-ssa-pre.c
branches/gcc-9-branch/gcc/tree-ssa-sccvn.c
branches/gcc-9-branch/gcc/tree-ssa-sccvn.h
branches/gcc-9-branch/gcc/tree-ssa-scopedtables.c

[Bug c++/91445] [9 Regression] After memset, logical && operator produces false result, optimization level >=O1

2019-08-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91445

--- Comment #8 from Richard Biener  ---
On trunk the following hunk "fixed" it.

@@ -2054,7 +2088,9 @@ vn_reference_lookup_3 (ao_ref *ref, tree
}
 }

-  if (*disambiguate_only)
+  /* If we are looking for redundant stores do not create new hashtable
+ entries from aliasing defs with made up alias-sets.  */
+  if (*disambiguate_only || !data->tbaa_p)
 return (void *)-1;

   /* If we cannot constrain the size of the reference we cannot

[Bug c++/91445] [9 Regression] After memset, logical && operator produces false result, optimization level >=O1

2019-08-15 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91445

Martin Liška  changed:

   What|Removed |Added

   Keywords|needs-bisection |
 CC||marxin at gcc dot gnu.org

--- Comment #7 from Martin Liška  ---
Looking at the test-case #1, the issue started with r260318 and was fixed with
r273135.

[Bug c++/91445] [9 Regression] After memset, logical && operator produces false result, optimization level >=O1

2019-08-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91445

Richard Biener  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

--- Comment #6 from Richard Biener  ---
FREs redundant store removal is guilty.

struct S { _Bool x; };

void foo (struct S *s)
{
  __builtin_memset (s, 0x11, sizeof (struct S));
  s->x = 1;
}

has the store to s->x removed.

[Bug c++/91445] [9 Regression] After memset, logical && operator produces false result, optimization level >=O1

2019-08-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91445

Richard Biener  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
  Known to work||10.0, 8.3.0
   Keywords||needs-bisection, wrong-code
   Last reconfirmed||2019-08-14
 CC||rguenth at gcc dot gnu.org
 Ever confirmed|0   |1
Summary|After memset, logical &&|[9 Regression] After
   |operator produces false |memset, logical && operator
   |result, optimization level  |produces false result,
   |>=O1|optimization level >=O1
   Target Milestone|--- |9.3
  Known to fail||9.1.0, 9.2.0

--- Comment #5 from Richard Biener  ---
Seems to work on trunk.