On Wed, Jan 25, 2012 at 6:36 AM, Andrew Pinski <pins...@gmail.com> wrote:
> Hi,
>  value_replacement in PHIOPT currently works only when there is one
> PHI (which is non virtual).
> http://gcc.gnu.org/ml/gcc-patches/2012-01/msg01195.html improves the
> situation but we can improve it even more as replacing a PHI argument
> with a SSA_NAME is almost always a benefit.
>
> This patch improves the situation even more for value replacement
> (though it does not fix all the cases I wanted to fix but that would
> require much more rewrite of phiopt that I was willing to take on
> right now, see the bug report for the two testcases where we miss
> still).  We improve the situation by just going through all the PHIs
> and seeing if we want to do value replacement and only remove the
> middle basic block if it is empty or we used the only assignment in
> the PHI (for if(p)a=&p->a;else a= 0; case).
>
> OK for 4.8? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Ok.

Thanks,
Richard.

> Note I have two improvements when both this and
> http://gcc.gnu.org/ml/gcc-patches/2012-01/msg01195.html are applied;
> remove the xfail and instead of gimple_seq_singleton_p use the new
> single_non_singleton_phi_for_edges (I will test that patch after both
> are applied).  Currently these patches are independent and I want to
> keep it that way.
>
> Thanks,
> Andrew Pinski
>
> ChangeLog:
> * tree-ssa-phiopt.c: Include tree-pretty-print.h for print_generic_expr.
> (tree_ssa_phiopt_worker): Go through all the PHIs for
> value_replacement instead of just the singleton one.
> (value_replacement): Change return type to int.  Return 0 instead of false.
> Allow the middle basic block to contain more than just the defining statement.
> Handle non empty middle basic blocks.
> * Makefile.in (tree-ssa-phiopt.o): Add tree-pretty-print.h
>
> testsuite/ChangeLog:
> * gcc.dg/tree-ssa/phi-opt-8.c: New testcase.
> * gcc.dg/tree-ssa/phi-opt-9.c: New testcase.

Reply via email to