Improve match_simplify_replacement in phi-opt
authorAndrew Pinski <apinski@marvell.com>
Tue, 1 Jun 2021 06:48:05 +0000 (06:48 +0000)
committerAndrew Pinski <apinski@marvell.com>
Tue, 8 Jun 2021 22:08:25 +0000 (22:08 +0000)
commitc4574d23cb07340918793a5a98ae7bb2988b3791
treef68278ceb99dd9423dc9d0b279dedca082a22fe1
parent61fc01806f376a780978a6dea165ec3dadef085b
Improve match_simplify_replacement in phi-opt

This improves match_simplify_replace in phi-opt to handle the
case where there is one cheap (non-call) preparation statement in the
middle basic block similar to xor_replacement and others.
This allows to remove xor_replacement which it does too.

OK?  Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Thanks,
Andrew Pinski

Changes since v1:
v3 - Just minor changes to using gimple_assign_lhs
instead of gimple_lhs and fixing a comment.
v2 - change the check on the preparation statement to
allow only assignments and no calls and only assignments
that feed into the phi.

gcc/ChangeLog:

PR tree-optimization/25290
* tree-ssa-phiopt.c (xor_replacement): Delete.
(tree_ssa_phiopt_worker): Delete use of xor_replacement.
(match_simplify_replacement): Allow one cheap preparation
statement that can be moved to before the if.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr96928-1.c: Fix testcase for now that ~
happens on the outside of the bit_xor.
gcc/testsuite/gcc.dg/tree-ssa/pr96928-1.c
gcc/tree-ssa-phiopt.c