https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89317
--- 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:d13b86f932ff7b9d8f41483fd869c637b67d4dec commit r13-4600-gd13b86f932ff7b9d8f41483fd869c637b67d4dec Author: Richard Biener <rguent...@suse.de> Date: Sun Dec 11 14:07:34 2022 +0100 tree-optimization/89317 - missed folding of (p + 4) - &p->d The PR notices we fail to simplify a_4 = &x_3(D)->data; b_5 = x_3(D) + 16; _1 = b_5 - a_4; together with the enabler handling ADDR_EXPR leafs in separate stmts in match.pd the suggested patterns work. PR tree-optimization/89317 * match.pd ((p + b) - &p->c -> b - offsetof(c)): New patterns. * gcc.dg/tree-ssa/pr89317.c: New testcase.