https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77745
--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> --- Author: rguenth Date: Thu Jan 26 08:16:37 2017 New Revision: 244918 URL: https://gcc.gnu.org/viewcvs?rev=244918&root=gcc&view=rev Log: 2017-01-26 Richard Biener <rguent...@suse.de> Backport from mainline 2016-09-27 Richard Biener <rguent...@suse.de> PR tree-optimization/77745 * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): When removing redundant stores make sure to check compatibility of the TBAA state for downstream accesses. * tree-ssa-sccvn.c (visit_reference_op_store): Likewise for when value-numbering virtual operands for store matches. * g++.dg/torture/pr77745.C: New testcase. 2016-09-29 Richard Biener <rguent...@suse.de> PR tree-optimization/77768 * tree-ssa-sccvn.c (visit_reference_op_store): Properly deal with stores to a place we know has a constant value. * tree-vrp.c (set_defs_to_varying): New helper avoiding writing to vr_const_varying. (vrp_initialize): Call it. (vrp_visit_stmt): Likewise. (evrp_dom_walker::before_dom_children): Likewise. * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): Handle stores to readonly memory when removing redundant stores. * gcc.dg/torture/pr77768.c: New testcase. Added: branches/gcc-5-branch/gcc/testsuite/g++.dg/torture/pr77745.C branches/gcc-5-branch/gcc/testsuite/gcc.dg/torture/pr77768.c Modified: branches/gcc-5-branch/gcc/ChangeLog branches/gcc-5-branch/gcc/testsuite/ChangeLog branches/gcc-5-branch/gcc/tree-ssa-pre.c branches/gcc-5-branch/gcc/tree-ssa-sccvn.c branches/gcc-5-branch/gcc/tree-vrp.c