tree-optimization/100434 - DSE aggregate call LHS
authorRichard Biener <rguenther@suse.de>
Wed, 5 May 2021 14:15:12 +0000 (16:15 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 10 May 2021 09:40:39 +0000 (11:40 +0200)
commita564da506f52be66ade298b562417641e87b549f
tree4a279c5890c1797e1f224007e151ad9f3c55abc7
parent877e620f381e7af83d386f2ffec6f47546dd07c5
tree-optimization/100434 - DSE aggregate call LHS

This makes DSE consider aggregate LHS of calls as dead, for pure
or const calls the whole stmt and for others by removing the LHS.

2021-05-05  Richard Biener  <rguenther@suse.de>

PR tree-optimization/100434
* tree-ssa-dse.c (initialize_ao_ref_for_dse): Handle
call LHS.
(dse_optimize_stmt): Handle call LHS by dropping the
LHS or the whole call if it doesn't have other
side-effects.
(pass_dse::execute): Adjust.

* gcc.dg/tree-ssa/ssa-dse-43.c: New testcase.
gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-43.c [new file with mode: 0644]
gcc/tree-ssa-dse.c