On Wed, Oct 20, 2021 at 12:54 PM Jeff Law via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > > > On 10/20/2021 12:58 AM, Richard Biener wrote: > > On Wed, Oct 20, 2021 at 1:14 AM Jeff Law via Gcc-patches > > <gcc-patches@gcc.gnu.org> wrote: > >> > >> > >> On 10/18/2021 10:54 PM, apinski--- via Gcc-patches wrote: > >>> From: Andrew Pinski <apin...@marvell.com> > >>> > >>> Instead of putting a full blow DCE after execute_fixup_cfg, it makes sense > >>> to try to remove the defining statement for the store that is being > >>> removed. > >>> Right now we only handle PHI node statements as there needs no extra > >>> checks > >>> except for it is only used once in the store statement. > >>> > >>> gcc/ChangeLog: > >>> > >>> * tree-cfg.c (maybe_remove_writeonly_store): Remove defining > >>> (PHI) statement of the store if possible. > >> This is the only part that I consider at all controversial. > >> > >> Is the case you're trying to handle such that you have to eliminate the > >> PHI immediately and can't wait until the next DCE pass? > >> > >> If so and we want to go this direction, should we pull this out into a > >> little routine? I'm a bit surprised we don't already have one or more > >> that do basically the same thing. > > We have simple_dce_from_worklist for this which you'd seed with > > the SSA rhs of the removed stores. > Yea, that seems like a better routine to use. Andrew, can you try that?
Yes that is a better routine to use, the patch is in testing right now. I should be able to submit it in a few hours. Thanks, Andrew > Jeff