https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119997
--- Comment #2 from GCC 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:fc62834533f357125b9c1934f80c2ba249adbf9e commit r16-281-gfc62834533f357125b9c1934f80c2ba249adbf9e Author: Richard Biener <rguent...@suse.de> Date: Tue Apr 29 11:06:36 2025 +0200 tree-optimization/119997 - &ptr->field no longer subject to PRE The following makes PRE handle &ptr->field the same as VN by treating it as a POINTER_PLUS_EXPR when possible and thus as 'nary'. To facilitate this the patch splits out vn_pp_nary_for_addr and adds const overloads for vec::last. The patch also avoids handling an effective zero offset as POINTER_PLUS_EXPR. PR tree-optimization/119997 * vec.h (vec<T, A, vl_embed>::last): Provide const overload. (vec<T, va_heap, vl_ptr>::last): Likewise. * tree-ssa-sccvn.h (vn_pp_nary_for_addr): Declare. * tree-ssa-sccvn.cc (vn_pp_nary_for_addr): Split out from ... (vn_reference_lookup): ... here. (vn_reference_insert): ... and duplicate here. Do not handle zero offset as POINTER_PLUS_EXPR. * tree-ssa-pre.cc (compute_avail): Implement ADDR_EXPR-as-POINTER_PLUS_EXPR special casing. * gcc.dg/tree-ssa/ssa-pre-35.c: New testcase.