On Mon, May 14, 2018 at 5:32 AM, Kugan Vivekanandarajah
<kugan.vivekanandara...@linaro.org> wrote:
> Hi Richard,
>
>>> Given the simple testcases you add I wonder if you want a cheaper
>>> implementation,
>>> namely check that when reaching a loop PHI the only aliasing stmt in
>>> its use-chain
>>> is the use_stmt you reached the PHI from.  That would avoid this and the 
>>> tests
>>> for the store being redundant and simplify the patch considerably.
>
> Tried implementing above in the attached patch.  Bootstrapped on
> x86_64-linux-gnu. Full testing is ongoing.

I think your phi_aliases_stmt_only is equal to

   has_single_use (PHI_RESULT (phi))
   && PHI_RESULT (phi) == gimple_vuse (defvar_def)

that is, we are sure we have

  phidef = PHI < , ... defvar>

  # defvar = VUSE <phidef>
  defvar_def stmt

testing it this way is also more clearly matchign the intended
structure.  Maybe you can
add the above IL picture as comment.

OK with that changes.

Richard.

> Thanks,
> Kugan
>
> gcc/ChangeLog:
>
> 2018-05-14  Kugan Vivekanandarajah  <kug...@linaro.org>
>
>     * tree-ssa-dse.c (phi_aliases_stmt_only): New.
>     (dse_classify_store): Use phi_aliases_stmt_only.
>
> gcc/testsuite/ChangeLog:
>
> 2018-05-14  Kugan Vivekanandarajah  <kug...@linaro.org>
>
>     * gcc.dg/tree-ssa/ssa-dse-31.c: New test.
>     * gcc.dg/tree-ssa/ssa-dse-32.c: New test.

Reply via email to