]> git.ipfire.org Git - thirdparty/gcc.git/commit
combine: Add REG_DEAD notes to the last instruction after a split [PR118914]
authorAndrew Pinski <quic_apinski@quicinc.com>
Thu, 20 Feb 2025 00:10:31 +0000 (16:10 -0800)
committerAndrew Pinski <quic_apinski@quicinc.com>
Fri, 21 Mar 2025 00:09:10 +0000 (17:09 -0700)
commite8a5f747cfa9c79ab7d95ff95d17d3e31afede50
tree2a20836243e954fec33741d2a24a8007d4a49a59
parent47822ef8f1b03ab7124aba694709825a93897994
combine: Add REG_DEAD notes to the last instruction after a split [PR118914]

So gcc.target/aarch64/rev16_2.c started to fail after r15-268-g9dbff9c05520a7,
the problem is combine now rejects the instruction combine. This happens because
after a different combine which uses a define_split and that define_split creates
a new pseudo register. That new pseudo register is dead after the last instruction
in the stream BUT combine never creates a REG_DEAD for it. So combine thinks it is
still needed after and now with the i2 not changing, combine rejects the combine.

Now combine should be creating a REG_DEAD for the new pseudo registers for the last
instruction of the split. This fixes rev16_2.c and also improves the situtation in
other cases by removing other dead instructions.

Bootstrapped and tested on aarch64-linux-gnu and x86_64-linux-gnu.

gcc/ChangeLog:

PR rtl-optimization/118914
* combine.cc (recog_for_combine): Add old_nregs and new_nregs
argument (defaulting to 0). Update call to recog_for_combine_1.
(combine_split_insns): Add old_nregs and new_nregs arguments,
store the old and new max registers to them.
(try_combine): Update calls to combine_split_insns and
pass old_nregs and new_nregs for the i3 call to recog_for_combine.
(find_split_point): Update call to combine_split_insns; ignoring
the values there.
(recog_for_combine_1): Add old_nregs and new_nregs arguments,
if the insn was recognized (and not to no-op move), add the
REG_DEAD notes to pnotes argument.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/combine.cc