]> git.ipfire.org Git - thirdparty/gcc.git/commit
[PR117946][LRA]: When assigning hard reg use biggest mode to check ira_prohibited_cla...
authorVladimir N. Makarov <vmakarov@redhat.com>
Tue, 10 Dec 2024 17:50:27 +0000 (12:50 -0500)
committerVladimir N. Makarov <vmakarov@redhat.com>
Tue, 10 Dec 2024 17:53:00 +0000 (12:53 -0500)
commit6fc3da8fa2af1d4ee154ea803636eabde358b553
treef7c3692ff54f2efe05ec3cd070d9edb2e830ce20
parentcf406a6c79ce404c45f99bcf2df3293269dbb462
[PR117946][LRA]: When assigning hard reg use biggest mode to check ira_prohibited_class_mode_regs

A pseudo in the PR test case gets hard reg 43 which is x86 r15 (after
r15, xmm regs go).  The pseudo is of INT_SSE_CLASS and SImode but is
used in TImode as paradoxical subreg.  r15 in TImode is wrong and does
not satisfy constraint 'r'.  Therefore LRA creates moves involving the
pseudo in TImode until the limit of reload insns is achieved.
Unfortunately x86 hard_regno_mode_ok (as some hooks for other targets)
says that it is ok to use r15 for TImode pseudo.  Therefore LRA uses
ira_prohibited_class_mode_regs for such cases but it was checked
against native pseudo mode.  The patch fixes it by using the biggest
pseudo mode.

gcc/ChangeLog:

PR rtl-optimization/117946
* lra-assigns.cc: (find_hard_regno_for_1): Use the biggest mode to
check ira_prohibited_class_mode_regs.

gcc/testsuite/ChangeLog:

PR rtl-optimization/117946
* gcc.target/i386/pr117946.c: New.
gcc/lra-assigns.cc
gcc/testsuite/gcc.target/i386/pr117946.c [new file with mode: 0644]