[gcc(refs/users/aoliva/heads/testme)] [lra] reorder operations in lra_update_fp2sp_elimination [PR120424]
Alexandre Oliva
aoliva@gcc.gnu.org
Sun Jun 22 06:20:38 GMT 2025
https://gcc.gnu.org/g:7146e6e0ee9fe3776e6629776a1a4efc77e70338
commit 7146e6e0ee9fe3776e6629776a1a4efc77e70338
Author: Alexandre Oliva <oliva@adacore.com>
Date: Sun Jun 22 03:11:09 2025 -0300
[lra] reorder operations in lra_update_fp2sp_elimination [PR120424]
The various recent additions to lra_update_fp2sp_elimination rendered
it somewhat confusing, with intermixed groups of statements pertaining
to three different major actions: disabling the elimination,
recomputing live ranges, and spilling uses of the frame pointer.
Reorder them for readability.
for gcc/ChangeLog
PR rtl-optimization/120424
* lra-elimination.cc (lra_update_fp2sp_elimination): Reorder
and regroup related statements.
Diff:
---
gcc/lra-eliminations.cc | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/gcc/lra-eliminations.cc b/gcc/lra-eliminations.cc
index 0a702a43a5a1..fb47388f80bf 100644
--- a/gcc/lra-eliminations.cc
+++ b/gcc/lra-eliminations.cc
@@ -1436,13 +1436,13 @@ lra_update_fp2sp_elimination (int *spilled_pseudos)
setup_can_eliminate (ep, false);
}
else
- ep = NULL;
+ for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++)
+ if (ep->from == FRAME_POINTER_REGNUM && ep->to == STACK_POINTER_REGNUM)
+ setup_can_eliminate (ep, false);
if (lra_dump_file != NULL)
fprintf (lra_dump_file,
" Frame pointer can not be eliminated anymore\n");
frame_pointer_needed = true;
- CLEAR_HARD_REG_SET (set);
- add_to_hard_reg_set (&set, Pmode, HARD_FRAME_POINTER_REGNUM);
/* If !lra_reg_spill_p, we likely have incomplete range information
for pseudos assigned to the frame pointer that will have to be
spilled, and so we may end up incorrectly sharing them unless we
@@ -1451,11 +1451,9 @@ 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 ();
+ CLEAR_HARD_REG_SET (set);
+ add_to_hard_reg_set (&set, Pmode, HARD_FRAME_POINTER_REGNUM);
n = spill_pseudos (set, spilled_pseudos);
- if (!ep)
- for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++)
- if (ep->from == FRAME_POINTER_REGNUM && ep->to == STACK_POINTER_REGNUM)
- setup_can_eliminate (ep, false);
return n;
}
More information about the Gcc-cvs
mailing list