]> gcc.gnu.org Git - gcc.git/commit
cfgrtl: Fix MEM_EXPR update in duplicate_insn_chain [PR114924]
authorAlex Coplan <alex.coplan@arm.com>
Fri, 3 May 2024 08:23:59 +0000 (09:23 +0100)
committerAlex Coplan <alex.coplan@arm.com>
Fri, 3 May 2024 12:47:55 +0000 (13:47 +0100)
commit242fbc0df6c23115c47d256e66fba6a770265c5d
treeb34cdca84318ac2c459d35710128b32727fccfbf
parentfa7e05d90bb672b58424ddbe37a05a0fd0949b35
cfgrtl: Fix MEM_EXPR update in duplicate_insn_chain [PR114924]

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.

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.

(cherry picked from commit fe40d525619eee9c2821126390df75068df4773a)
gcc/cfgrtl.cc
This page took 0.060948 seconds and 6 git commands to generate.