https://gcc.gnu.org/g:271a0746cebb60d6ee519a271f28f1fbd2692b4f
commit 271a0746cebb60d6ee519a271f28f1fbd2692b4f Author: Alexandre Oliva <ol...@adacore.com> Date: Sun Jun 22 15:06:53 2025 -0300 [lra] don't spill when disabling fp2sp elimination [PR120424] We still have problems with the logic of disabling the fp2sp elimination. An x86_64-linux-gnu bootstrap with ix86_frame_pointer_required tweaked to require a frame pointer when the frame size is positive miscompiles libiberty/regex.c in stage2, and arm-linux-gnueabihf with {BOOT_CFLAGS,TFLAGS}='-O2 -g -fnon-call-exceptions -fstack-clash-protection' crashes in gen-fac within gmp. With this simplification, the latter bootstraps successfully (in both arm and thumb modes), so that's progress, but spilling *should* work here, and libiberty/regex.c o x86_64 still gets miscompiled and causes gengtype -r gtype.state to malfunction in stage2, but I can't debug this any further, so problems remain. We have a reliable workaround for arm, namely, disabling the frame size-based optimization in arm_frame_pointer_required. for gcc/ChangeLog PR rtl-optimization/120424 * lra-eliminations.cc (lra_update_fp2sp_elimination): Skip spilling. Diff: --- gcc/lra-eliminations.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gcc/lra-eliminations.cc b/gcc/lra-eliminations.cc index 5713a9680523..931b579e2de8 100644 --- a/gcc/lra-eliminations.cc +++ b/gcc/lra-eliminations.cc @@ -1451,9 +1451,21 @@ lra_update_fp2sp_elimination (int *spilled_pseudos) /* If lives ranges changed, update the aggregate live ranges in slots as well before spilling any further pseudos. */ lra_recompute_slots_live_ranges (); +#if 0 + /* These spills will take place during update_reg_eliminate anyway, + but we probably get improved sharing of slots at this point. The + problem is that it breaks arm-linux-gnueabihf bootstrap with + {BOOT_CFLAGS,TFLAGS}='-O2 -g -fnon-call-exceptions + -fstack-clash-protection', because gmp's gen-fac crashes in + stage2 (arm). Spilling here *should* work, and some breakage + remains: x86_64-linux-gnu with ix86_frame_pointer_required + tweaked to return nonzero on positive frame sizes, to exercise + this case, miscompiles regex.c in stage2, so gengtype -r + gtype.state fails to match filenames. */ CLEAR_HARD_REG_SET (set); add_to_hard_reg_set (&set, Pmode, HARD_FRAME_POINTER_REGNUM); n = spill_pseudos (set, spilled_pseudos); +#endif return n; }