rtl-ssa: Ensure new defs get inserted [PR113070]
commit6dd613df59060fb54c4e3f66f39cf59bc44d118a
authorAlex Coplan <alex.coplan@arm.com>
Fri, 12 Jan 2024 09:09:10 +0000 (12 09:09 +0000)
committerAlex Coplan <alex.coplan@arm.com>
Tue, 23 Jan 2024 13:22:11 +0000 (23 13:22 +0000)
treeda3346f02a64523e4ea8fd5730974cc974790cb4
parentfce3994d04fc5d7d1c91f6db5a1f144aa291439a
rtl-ssa: Ensure new defs get inserted [PR113070]

In r14-5820-ga49befbd2c783e751dc2110b544fe540eb7e33eb I added support to
RTL-SSA for inserting new insns, which included support for users
creating new defs.

However, I missed that apply_changes_to_insn needed updating to ensure
that the new defs actually got inserted into the main def chain.  This
meant that when the aarch64 ldp/stp pass inserted a new stp insn, the
stp would just get skipped over during subsequent alias analysis, as its
def never got inserted into the memory def chain.  This (unsurprisingly)
led to wrong code.

This patch fixes the issue by ensuring new user-created defs get
inserted.  I would have preferred to have used a flag internal to the
defs instead of a separate data structure to keep track of them, but since
machine_mode increased to 16 bits we're already at 64 bits in access_info,
and we can't really reuse m_is_temp as the logic in finalize_new_accesses
requires it to get cleared.

gcc/ChangeLog:

PR target/113070
* rtl-ssa.h: Include hash-set.h.
* rtl-ssa/changes.cc (function_info::finalize_new_accesses): Add
new_sets parameter and use it to keep track of new user-created sets.
(function_info::apply_changes_to_insn): Also call add_def on new sets.
(function_info::change_insns): Add hash_set to keep track of new
user-created defs.  Plumb it through.
* rtl-ssa/functions.h: Add hash_set parameter to finalize_new_accesses and
apply_changes_to_insn.
gcc/rtl-ssa.h
gcc/rtl-ssa/changes.cc
gcc/rtl-ssa/functions.h