https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107699
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:892e8c520be37d0a0f14e2ae375103c5303ed549 commit r13-4555-g892e8c520be37d0a0f14e2ae375103c5303ed549 Author: Richard Biener <rguent...@suse.de> Date: Thu Dec 8 09:07:36 2022 +0100 tree-optimization/107699 - missed &data._M_elems + _1 != &data._M_elems folding The following addresses a missed folding noticed in PR107699 that can be fixed amending the existing &x + a != &x + b pattern to also handle the case of only one side having a pointer plus. I'm moving the patterns next to related simpifications showing there'd be an existing pattern matching this if it were not gated with an explicit single_use constraint. Note the new pattern also handles &x.a + a != &x.b, but this hints at some unification / generalization opportunities here. PR tree-optimization/107699 * match.pd (&a !=/== &a.b + c -> (&a - &a.b) !=/== c): New pattern variant. * gcc.dg/tree-ssa/pr107699.c: New testcase.