]> git.ipfire.org Git - thirdparty/gcc.git/commit
MATCH: Add some more value_replacement simplifications to match
authorAndrew Pinski <pinskia@gmail.com>
Sat, 28 Oct 2023 02:23:52 +0000 (19:23 -0700)
committerAndrew Pinski <pinskia@gmail.com>
Tue, 31 Oct 2023 02:15:25 +0000 (19:15 -0700)
commit541b754c77ab806a9dae9bbaae69722e2c36f0f0
tree6c8b211cd6320eaa341e557604401896ad75cd30
parent598fdb5290dcf76ef23e993409e22f1512ff835a
MATCH: Add some more value_replacement simplifications to match

This moves a few more value_replacements simplifications to match.
/* a == 1 ? b : a * b -> a * b */
/* a == 1 ? b : b / a  -> b / a */
/* a == -1 ? b : a & b -> a & b */

Also adds a testcase to show can we catch these where value_replacement would not
(but other passes would).

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

gcc/ChangeLog:

* match.pd (`a == 1 ? b : a OP b`): New pattern.
(`a == -1 ? b : a & b`): New pattern.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/phi-opt-value-4.c: New test.
gcc/match.pd
gcc/testsuite/gcc.dg/tree-ssa/phi-opt-value-4.c [new file with mode: 0644]