LRA: Always do elimination and only for hard register to check insn constraints
authorVladimir N. Makarov <vmakarov@redhat.com>
Tue, 24 Jan 2023 21:10:59 +0000 (16:10 -0500)
committerVladimir N. Makarov <vmakarov@redhat.com>
Tue, 24 Jan 2023 21:13:36 +0000 (16:13 -0500)
commit265a749f290f7c6adc9a3aaa9c585b498a8a38ea
tree4c4c550d7af39bfcafc1ac88d3d55ec926fc67f6
parent6c96382eed96a9285611f2e3e2e59557094172b8
LRA: Always do elimination and only for hard register to check insn constraints

LRA does elimination but not always checks insn constraints in this case.
This results in LRA failure for PDP11 target whose addition is only 2-op insn.
The same might happen for other analogous targets.  The patch fixes this problem.

        PR rtl-optimization/108388

gcc/ChangeLog:

* lra-constraints.cc (get_hard_regno): Remove final_p arg.  Always
do elimination but only for hard register.
(operands_match_p, uses_hard_regs_p, process_alt_operands): Adjust
calls of get_hard_regno.

gcc/testsuite/ChangeLog:

* gcc.target/pdp11/pdp11.exp: New.
* gcc.target/pdp11/pr108388.c: New.
gcc/lra-constraints.cc
gcc/testsuite/gcc.target/pdp11/pdp11.exp [new file with mode: 0644]
gcc/testsuite/gcc.target/pdp11/pr108388.c [new file with mode: 0644]