On 7/9/24 9:28 AM, Richard Sandiford wrote:
change_insns is used to change multiple instructions at once, so that
the IR on return is valid & self-consistent.  These changes can involve
moving instructions, and the new position for one instruction might
be expressed in terms of the old position of another instruction
that is changing at the same time.

change_insns therefore adds placeholder instructions to mark each
new instruction position, then replaces each placeholder with the
corresponding real instruction.  This replacement was done in two
steps: removing the old placeholder instruction and inserting the new
real instruction.  But it's more convenient for the upcoming fix for
PR115785 if we do the operation as a single step.  That should also
be slightly more efficient, since e.g. no splay tree operations are
needed.

This operation happens purely on the rtl-ssa instruction chain.
The placeholders are never represented in rtl.

Bootstrapped & regression-tested on aarch64-linux-gnu and
x86_64-linux-gnu.  OK to install?

Richard


gcc/
        PR rtl-optimization/115785
        * rtl-ssa/functions.h (function_info::replace_nondebug_insn): Declare.
        * rtl-ssa/insns.h (insn_info::order_node::set_uid): New function.
        (insn_info::remove_note): Declare.
        * rtl-ssa/insns.cc (insn_info::remove_note): New function.
        (function_info::replace_nondebug_insn): Likewise.
        * rtl-ssa/changes.cc (function_info::change_insns): Use
        replace_nondebug_insn instead of remove_insn + add_insn.
OK
jeff

Reply via email to