From: Alexandre Oliva Date: Fri, 27 Jun 2025 00:01:26 +0000 (-0300) Subject: [lra] reorder operations in lra_update_fp2sp_elimination [PR120424] X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=66b6da3b66ed0fe79e5db79b41eabe82952d1a9b;p=thirdparty%2Fgcc.git [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-eliminations.cc (lra_update_fp2sp_elimination): Reorder and regroup related statements. --- diff --git a/gcc/lra-eliminations.cc b/gcc/lra-eliminations.cc index 0a702a43a5a..5713a968052 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; }