]> git.ipfire.org Git - thirdparty/gcc.git/commit
[PR114991][IRA]: Improve reg equiv invariant calculation
authorVladimir N. Makarov <vmakarov@redhat.com>
Mon, 10 Mar 2025 20:26:59 +0000 (16:26 -0400)
committerVladimir N. Makarov <vmakarov@redhat.com>
Mon, 10 Mar 2025 20:27:51 +0000 (16:27 -0400)
commite355fe414aa3aaf215c7dd9dd789ce217a1b458c
tree38cafa529d783837179421778dcf3c497f4b8127
parent40a4f3dead623db86bc8f7255cbe524701f4aeb0
[PR114991][IRA]: Improve reg equiv invariant calculation

In PR test case IRA preferred to allocate hard reg to a pseudo instead
of its equivalence.  This resulted in allocating caller-saved hard reg
and generating save/restore insns in the function prologue/epilogue.
The equivalence is an invariant (stack pointer plus offset) and the
pseudo is used mostly as memory address.  This happened as there was
no simplification of insn after the invariant substitution.  The patch
adds the necessary code.

gcc/ChangeLog:

PR target/114991
* ira-costs.cc (equiv_can_be_consumed_p): Add new argument invariant_p.
Add code for dealing with the invariant.
(calculate_equiv_gains): Don't consider init insns.  Pass the new
argument to equiv_can_be_consumed_p.  Don't treat invariant as
memory.

gcc/testsuite/ChangeLog:

PR target/114991
* gcc.target/aarch64/pr114991.c: New test.
gcc/ira-costs.cc
gcc/testsuite/gcc.target/aarch64/pr114991.c [new file with mode: 0644]