[PATCH] phiopt: Handle bool in two_value_replacement [PR796232]
authorJakub Jelinek <jakub@redhat.com>
Sun, 6 Dec 2020 09:58:10 +0000 (10:58 +0100)
committerJakub Jelinek <jakub@redhat.com>
Sun, 6 Dec 2020 09:58:10 +0000 (10:58 +0100)
commit8c23434fdadcf4caa1f0e966294c5f67ccf4bcf9
treeab85825958107ecc849c9da1e95a51d2670a545d
parent9e12b8b1819342ef7efac58cf7f4ba4294abe551
[PATCH] phiopt: Handle bool in two_value_replacement [PR796232]

The following patch improves code generation on the included testcase by
enabling two_value_replacement on booleans.  It does that only for arg0/arg1
values that conditional_replacement doesn't handle.  Additionally
it limits two_value_replacement optimization to the late phiopt like
conditional_replacement.

2020-12-06  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/96232
* tree-ssa-phiopt.c (two_value_replacement): Optimize even boolean lhs
cases as long as arg0 has wider precision and conditional_replacement
doesn't handle that case.
(tree_ssa_phiopt_worker): Don't call two_value_replacement during
early phiopt.

* gcc.dg/tree-ssa/pr96232-2.c: New test.
* gcc.dg/tree-ssa/pr88676-2.c: Check phiopt2 dump rather than phiopt1.
gcc/testsuite/gcc.dg/tree-ssa/pr88676-2.c
gcc/testsuite/gcc.dg/tree-ssa/pr96232-2.c [new file with mode: 0644]
gcc/tree-ssa-phiopt.c