https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102216
--- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:911b633803dcbb298c98777e29fd260834c0d04a commit r12-5465-g911b633803dcbb298c98777e29fd260834c0d04a Author: Andrew Pinski <apin...@marvell.com> Date: Tue Nov 23 01:08:55 2021 +0000 Canonicalize &MEM[ssa_n, CST] to ssa_n p+ CST in fold_stmt_1 This is a new version of the patch to fix PR 102216. Instead of doing the canonicalization inside forwprop, Richi mentioned we should do it inside fold_stmt_1 and that is what this patch does. PR tree-optimization/102216 gcc/ChangeLog: * gimple-fold.c (fold_stmt_1): Add canonicalization of "&MEM[ssa_n, CST]" to "ssa_n p+ CST", note this can only be done if !in_place. gcc/testsuite/ChangeLog: * g++.dg/tree-ssa/pr102216-1.C: New test. * g++.dg/tree-ssa/pr102216-2.C: New test.