]> git.ipfire.org Git - thirdparty/gcc.git/commit
lra: Updates of biggest mode for hard regs [PR112278]
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 5 Dec 2023 09:20:55 +0000 (09:20 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 5 Dec 2023 09:20:55 +0000 (09:20 +0000)
commit6e2e0ce6795c863e295eb33559f8dc0500297da3
tree264a8e7c8451adb224f294c267dcd3457fae5f2d
parent1a84af19cd18730477dbceaebc45466c3fd77b60
lra: Updates of biggest mode for hard regs [PR112278]

LRA keeps track of the biggest mode for both hard registers and
pseudos.  The updates assume that the modes are ordered, i.e. that
we can tell whether one is no bigger than the other at compile time.

That is (or at least seemed to be) a reasonable restriction for pseudos.
But it isn't necessarily so for hard registers, since the uses of hard
registers can be logically distinct.  The testcase is an example of this.

The biggest mode of hard registers is also special for other reasons.
As the existing comment says:

  /* A reg can have a biggest_mode of VOIDmode if it was only ever seen as
     part of a multi-word register.  In that case, just use the reg_rtx
     mode.  Do the same also if the biggest mode was larger than a register
     or we can not compare the modes.  Otherwise, limit the size to that of
     the biggest access in the function or to the natural mode at least.  */

This patch applies the same approach to the updates.

gcc/
PR rtl-optimization/112278
* lra-int.h (lra_update_biggest_mode): New function.
* lra-coalesce.cc (merge_pseudos): Use it.
* lra-lives.cc (process_bb_lives): Likewise.
* lra.cc (new_insn_reg): Likewise.

gcc/testsuite/
PR rtl-optimization/112278
* gcc.target/aarch64/sve/pr112278.c: New test.
gcc/lra-coalesce.cc
gcc/lra-int.h
gcc/lra-lives.cc
gcc/lra.cc
gcc/testsuite/gcc.target/aarch64/sve/pr112278.c [new file with mode: 0644]