diff options
author | Konstantinos Eleftheriou <konstantinos.eleftheriou@vrull.eu> | 2024-08-07 17:54:30 +0200 |
---|---|---|
committer | Philipp Tomsich <philipp.tomsich@vrull.eu> | 2024-09-25 16:25:26 +0200 |
commit | a88d6c6d777ad7c9235e2e620318f26e5347e50a (patch) | |
tree | 8c606b0cce462459c9095d0c768a89ab5ee16d76 /gcc/tree-vectorizer.h | |
parent | 0e095df4b4c61bc57413cf3cbca56ff1a038de40 (diff) | |
download | gcc-a88d6c6d777ad7c9235e2e620318f26e5347e50a.zip gcc-a88d6c6d777ad7c9235e2e620318f26e5347e50a.tar.gz gcc-a88d6c6d777ad7c9235e2e620318f26e5347e50a.tar.bz2 |
match: Fix A || B not optimized to true when !B implies A [PR114326]
In expressions like (a != b || ((a ^ b) & c) == d) and
(a != b || (a ^ b) == c), (a ^ b) is folded to false.
In the equivalent expressions (((a ^ b) & c) == d || a != b) and
((a ^ b) == c || a != b) this is not happening.
This patch adds the following simplifications in match.pd:
((a ^ b) & c) cmp d || a != b --> 0 cmp d || a != b
(a ^ b) cmp c || a != b --> 0 cmp c || a != b
PR tree-optimization/114326
gcc/ChangeLog:
* match.pd: Add two patterns to fold a ^ b to 0, when a == b.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/fold-xor-and-or.c: New test.
* gcc.dg/tree-ssa/fold-xor-or.c: New test.
Tested-by: Christoph Müllner <christoph.muellner@vrull.eu>
Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Signed-off-by: Konstantinos Eleftheriou <konstantinos.eleftheriou@vrull.eu>
Diffstat (limited to 'gcc/tree-vectorizer.h')
0 files changed, 0 insertions, 0 deletions