RISC-V: Shorten memrefs improvement, partial fix 97417.
authorJim Wilson <jimw@sifive.com>
Sat, 13 Feb 2021 20:13:08 +0000 (12:13 -0800)
committerJim Wilson <jimw@sifive.com>
Sat, 13 Feb 2021 20:13:08 +0000 (12:13 -0800)
commita4953810bac524e19126a2745c75fed58db962c2
tree3e20f457a714b6bf09c330ee55f46fe24260dac3
parent05402ca65a6696a8f20a3dbcb18f47ba3bdfa268
RISC-V: Shorten memrefs improvement, partial fix 97417.

We already have a check for riscv_shorten_memrefs in riscv_address_cost.
This adds the same check to riscv_rtx_costs.  Making this work also
requires a change to riscv_compressed_lw_address_p to work before reload
by checking the offset and assuming any pseudo reg is OK.  Testing shows
that this consistently gives small code size reductions.

gcc/
PR target/97417
* config/riscv/riscv.c (riscv_compressed_lw_address_p): Drop early
exit when !reload_completed.  Only perform check for compressed reg
if reload_completed.
(riscv_rtx_costs): In MEM case, when optimizing for size and
shorten memrefs, if not compressible, then increase cost.
gcc/config/riscv/riscv.c