tree-optimization/89317 - another pattern for &p->x != p + 4
authorRichard Biener <rguenther@suse.de>
Mon, 12 Dec 2022 07:13:33 +0000 (08:13 +0100)
committerRichard Biener <rguenther@suse.de>
Mon, 12 Dec 2022 07:54:53 +0000 (08:54 +0100)
commit2dc5d6b1e7ec8822f5bd78761962ca2c85d4a2b4
tree4813826210ce72d04237ce61df050b4300f418e0
parent324e9953400999872a0a57524399d86e6414c149
tree-optimization/89317 - another pattern for &p->x != p + 4

As seen in the original testcase for PR89317 we are missing
comparison simplification patterns for &p->x != p + 4.  Fixed
by making an existing one apply.  To make the pattern apply
during CCP we need to simplify ccp_fold to not use GENERIC
folding of conditions but also use GIMPLE folding.

PR tree-optimization/89317
* tree-ssa-ccp.cc (ccp_fold): Handle GIMPLE_COND via
gimple_fold_stmt_to_constant_1.
* match.pd (&a != &a + c): Apply to pointer_plus with non-ADDR_EXPR
base as well.

* gcc.dg/tree-ssa/pr89317.c: Amend.
gcc/match.pd
gcc/testsuite/gcc.dg/tree-ssa/pr89317.c
gcc/tree-ssa-ccp.cc