]> git.ipfire.org Git - thirdparty/gcc.git/commit
[lra] recompute ranges upon disabling fp2sp elimination [PR120424]
authorAlexandre Oliva <oliva@adacore.com>
Fri, 27 Jun 2025 00:01:22 +0000 (21:01 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Fri, 27 Jun 2025 00:01:22 +0000 (21:01 -0300)
commitbe547188b632d8c1072341c431af339b7384c4a6
tree504bbe0d3013f37f3d72abc6c340f0978c421219
parent6c554467623ec53ae228d127cbec9c4ba3cdc027
[lra] recompute ranges upon disabling fp2sp elimination [PR120424]

If the frame size grows to nonzero, arm_frame_pointer_required may
flip to true under -fstack-clash-protection -fnon-call-exceptions, and
that may disable the fp2sp elimination part-way through lra.

If pseudos had got assigned to the frame pointer register before that,
they have to be spilled, and that requires complete live range
information.  If !lra_reg_spill_p, lra_spill won't have live ranges
for such pseudos, and they could end up sharing spill slots with other
pseudos whose live ranges actually overlap.

This affects at least Ada.Strings.Wide_Superbounded.Super_Insert and
.Super_Replace_Slice in libgnat/a-stwisu.adb, when compiled with -O2
-fstack-clash-protection -march=armv7 (implied Thumb2), causing
acats-4's cdd2a01 to fail.

Recomputing live ranges including registers may renumber and compress
points, so we have to recompute the aggregated live ranges for
already-assigned spill slots as well.

As a safety net, reject empty live ranges when computing slot sharing.

for  gcc/ChangeLog

PR rtl-optimization/120424
* lra-eliminations.cc (lra_update_fp2sp_elimination):
Compute complete live ranges and recompute slots' live ranges
if needed.
* lra-lives.cc (lra_reset_live_range_list): New.
(lra_complete_live_ranges): New.
* lra-spills.cc (assign_spill_hard_regs): Reject empty live
ranges.
(add_pseudo_to_slot): Likewise.
(lra_recompute_slots_live_ranges): New.
* lra-int.h (lra_reset_live_range_list): Declare.
(lra_complete_live_ranges): Declare.
(lra_recompute_slots_live_ranges): Declare.
gcc/lra-eliminations.cc
gcc/lra-int.h
gcc/lra-lives.cc
gcc/lra-spills.cc