]> gcc.gnu.org Git - gcc.git/commit
MATCH: `a | C -> C` when we know that `a & ~C == 0`
authorAndrew Pinski <apinski@marvell.com>
Sun, 20 Aug 2023 00:56:46 +0000 (17:56 -0700)
committerAndrew Pinski <apinski@marvell.com>
Fri, 25 Aug 2023 16:34:59 +0000 (09:34 -0700)
commit6df8dcec7196e42ca2eed69e1ae455bae8d0fe93
treeffaee6798eb0a9e23da78484826ae97975b5b728
parent4024ddbe50c2d1cb54c75304c72817d3fc63cdb6
MATCH: `a | C -> C` when we know that `a & ~C == 0`

Even though this is handled by other code inside both VRP and CCP,
sometimes we want to optimize this outside of VRP and CCP.
An example is given in PR 106677 where phiopt will happen
after VRP (which removes a cast for a comparison) and then
phiopt will optimize the phi to be `a | 1` which can then
be optimized to `1` due to this patch.

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

Note Similar code already exists in simplify_rtx for the RTL level;
it was moved from combine to simplify_rtx in r0-72539-gbd1ef757767f6d.
gcc/ChangeLog:

* match.pd (`a | C -> C`): New pattern.
gcc/match.pd
This page took 0.062822 seconds and 6 git commands to generate.