https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93820

--- Comment #7 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 25 Feb 2020, jakub at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93820
> 
> --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> On the original testcase, the reason why dse3 doesn't help is we have:
>   a[4] = 1;
>   _4 = *c.0_1;
>   a[5] = _4;
>   a[3] = 1;
>   e = 0;
>   a[8] = 0;
>   MEM <vector(4) int> [(int *)&a + 16B] = { 0, 0, 0, 0 };
> and c.0_1 might alias the a array, so dse3 removes a[5] store as redundant, 
> but
> only later cddce removes the _4 = *c.0_1 load and only then the a[4] = 1; 
> store
> could be also removed (i.e. it would require iteration, or performing some 
> kind
> of (cheap) dce in the dse pass after removing each store).

A simple immediate-use / worklist based DCE would be possible after each
DSE but then this always felt like too ad-hoc to me ...

It would also have hidden this bug in store-merging (which is also
why I prefer the GIMPLE testcase at least for the affected function
since there's 100s of passes before store-merging)

Reply via email to