On Thu, 2 May 2024, Alex Coplan wrote: > Hi, > > The PR shows that when cfgrtl.cc:duplicate_insn_chain attempts to > update the MR_DEPENDENCE_CLIQUE information for a MEM_EXPR we can end up > accidentally dropping (e.g.) an ARRAY_REF from the MEM_EXPR and end up > replacing it with the underlying MEM_REF. This leads to an > inconsistency in the MEM_EXPR information, and could lead to wrong code. > > While the walk down to the MEM_REF is necessary to update > MR_DEPENDENCE_CLIQUE, we should use the outer tree expression for the > MEM_EXPR. This patch does that. > > Bootstrapped/regtested on aarch64-linux-gnu, no regressions. OK for > trunk? What about backports?
OK for trunk and branches, including 14, I think this is quite safe. Thanks, Richard. > Thanks, > Alex > > gcc/ChangeLog: > > PR rtl-optimization/114924 > * cfgrtl.cc (duplicate_insn_chain): When updating MEM_EXPRs, > don't strip (e.g.) ARRAY_REFs from the final MEM_EXPR. > -- Richard Biener <rguent...@suse.de> SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)