tree-optimization/91123 - restore redundant store removal
authorRichard Biener <rguenther@suse.de>
Fri, 31 Jan 2020 12:28:11 +0000 (13:28 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 4 Feb 2020 09:08:05 +0000 (10:08 +0100)
commit5f0653a8b75a5ad5a5405a27dd92d3a5759eed4c
tree8ec13218e79d1e894acad91898dce6bcc74e585e
parentfc98d038618b792c413212759057b2125507d3ef
tree-optimization/91123 - restore redundant store removal

Redundant store removal in FRE was restricted for correctness reasons.
The following extends correctness fixes required to memcpy/aggregate
copy translation.  The main change is that we no longer insert
references rewritten to cover such aggregate copies into the hashtable
but the original one.

2020-02-04  Richard Biener  <rguenther@suse.de>

PR tree-optimization/91123
* tree-ssa-sccvn.c (vn_walk_cb_data::finish): New method.
(vn_walk_cb_data::last_vuse): New member.
(vn_walk_cb_data::saved_operands): Likewsie.
(vn_walk_cb_data::~vn_walk_cb_data): Release saved_operands.
(vn_walk_cb_data::push_partial_def): Use finish.
(vn_reference_lookup_2): Update last_vuse and use finish if
we've saved operands.
(vn_reference_lookup_3): Use finish and update calls to
push_partial_defs everywhere.  When translating through
memcpy or aggregate copies save off operands and alias-set.
(eliminate_dom_walker::eliminate_stmt): Restore VN_WALKREWRITE
operation for redundant store removal.

* gcc.dg/tree-ssa/ssa-fre-85.c: New testcase.
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-85.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.c