[PR97969] LRA: Transform pattern `plus (plus (hard reg, const), pseudo)` after elimin...
authorVladimir N. Makarov <vmakarov@redhat.com>
Tue, 12 Jan 2021 16:26:15 +0000 (11:26 -0500)
committerVladimir N. Makarov <vmakarov@redhat.com>
Tue, 12 Jan 2021 16:27:29 +0000 (11:27 -0500)
commitcf2ac1c30af0fa783c8d72e527904dda5d8cc330
treea4bc0604739c4732d2e9770af00f7eabcde03d2a
parente0bec6ceac47752616dd9fe0801344ed45db2fd3
[PR97969] LRA: Transform pattern `plus (plus (hard reg, const), pseudo)` after elimination

LRA can loop infinitely on targets without `reg + imm` insns.  Register elimination
on such targets can increase register pressure resulting in permanent
stack size increase and changing elimination offset.  To avoid such situation, a simple
transformation can be done to avoid register pressure increase after
generating reload insns containing eliminated hard regs.

gcc/ChangeLog:

PR target/97969
* lra-eliminations.c (eliminate_regs_in_insn): Add transformation
of pattern 'plus (plus (hard reg, const), pseudo)'.

gcc/testsuite/ChangeLog:

PR target/97969
* gcc.target/arm/pr97969.c: New.
gcc/lra-eliminations.c
gcc/testsuite/gcc.target/arm/pr97969.c [new file with mode: 0644]