On 5/16/25 11:22 AM, Richard Sandiford wrote:
gen_exp has code to detect when the same operand is used multiple
times.  It ensures that second and subsequent uses call copy_rtx,
to enforce correct unsharing.

However, for historical reasons that aren't clear to me, this was
skipped for a define_insn unless the define_insn was a parallel.
It was also skipped for a single define_expand instruction,
regardless of its contents.

This meant that a single parallel instruction was treated differently
between define_insn (where sharing rules were followed) and
define_expand (where sharing rules weren't followed).  define_splits
and define_peephole2s followed the sharing rules in all cases.

This patch makes everything follow the sharing rules.  The code
it touches will be removed by the proposed bytecode-based expansion,
which will use its own tracking when enforcing sharing rules.
However, it seemed better for staging and bisection purposes
to make this change first.

gcc/
        * genemit.cc (generator::used): Update comment.
        (generator::gen_exp): Remove handling of null unused arrays.
        (gen_insn, gen_expand): Always pass a used array.
        (output_add_clobbers): Note why the used array is null here.
OK
jeff

Reply via email to