]> git.ipfire.org Git - thirdparty/gcc.git/commit
[lra] rework deactivation of fp2sp elimination [PR120424]
authorAlexandre Oliva <oliva@adacore.com>
Fri, 27 Jun 2025 00:01:24 +0000 (21:01 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Fri, 27 Jun 2025 00:01:24 +0000 (21:01 -0300)
commitb49473448966b045460a23794ed9a309e503fa3b
tree9d7ebe6682da005dcd68b73d20276559b887a15b
parentbe547188b632d8c1072341c431af339b7384c4a6
[lra] rework deactivation of fp2sp elimination [PR120424]

Deactivating the fp2sp elimination in lra_update_fp2sp_elimination
prevents update_reg_eliminate from propagating the fp2sp elimination
offset to the next chosen elimination, so it may retain -1 as the
prev_offset, and prev_offset will be taken as an already-applied
offset that needs to be compensated in the next round of spilling and
reloading.  This affects, for example, crtbegin.o's
__do_global_dtors_aux on arm-linux-gnueabihf in a {BOOT_C,T}FLAGS='-O2
-g -fnon-call-exceptions -fstack-clash-protection' bootstrap.

Alas, just retaining that elimination causes spills to use the fp2sp
elimination, including applying sp offsets, which breaks e.g. an
x86_64-linux-gnu native bootstrap with ix86_frame_pointer_required
modified to return true on nonzero frame size.

The middle-ground solution is to keep the elimination active, so that
its offsets are applied and propagated on to the subsequent fp
elimination, but without introducing sp offsets, so that
e.g. pr103973-18.c on the modified x86_64-linux-gnu doesn't get
adjacent argument pushes of two adjacent on-stack temporaries ending
up pushing the same temporary because of undesired adjustments.

for  gcc/ChangeLog

PR rtl-optimization/120424
* lra-eliminations.cc (lra_update_fp2sp_elimination):
Avoid sp offsets in further fp2sp eliminations...
(update_reg_eliminate): ... and restore to_rtx before assert
checking.
gcc/lra-eliminations.cc