On 9/3/23 14:49, Andrew Pinski via Gcc-patches wrote:
Like the pattern already there for `(x | y) & x`, this adds a simple pattern to optimize `(x | y) & (x & z)` to just `x & z`. OK? Bootstrapped and tested on x86-64-linux-gnu with no regressions. gcc/ChangeLog: PR tree-optimization/103536 * match.pd (`(x | y) & (x & z)`, `(x & y) | (x | z)`): New patterns. gcc/testsuite/ChangeLog: PR tree-optimization/103536 * gcc.dg/tree-ssa/andor-6.c: New test. * gcc.dg/tree-ssa/andor-bool-1.c: New test.
OK. jeff