The patch in the attachment solves the following https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124452
The patch was successfully bootstrapped and tested on x86_64 and ppc64le.
commit 772ec2d96ed73568203af8fa6669ee36988497d1 Author: Vladimir N. Makarov <[email protected]> Date: Thu Mar 12 16:47:16 2026 -0400 [PR124452, LRA]: Move point of skipping postponed insn Patch for PR115042 skipped processing postponed insns after possible generation of address reloads for the postponed insns. The reload insns were lost in the code and this resulted in wrong code generation. To fix this the patch moves skipping the postponed insn before any reload generation. gcc/ChangeLog: PR rtl-optimization/124452 * lra-constraints.cc (curr_insn_transform): Move return on the postponed insn before any reload generation. diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc index fae7b49bdbd..485ffa98c40 100644 --- a/gcc/lra-constraints.cc +++ b/gcc/lra-constraints.cc @@ -4452,7 +4452,14 @@ curr_insn_transform (bool check_only_p) } } - /* Reload address registers and displacements. We do it before + /* We process equivalences before ignoring postponed insns on the current + constraint sub-pass but before any reload insn generation for the + postponed insn. */ + if (! check_only_p + && bitmap_bit_p (&lra_postponed_insns, INSN_UID (curr_insn))) + return true; + + /* Reload address registers and displacements. We do it before finding an alternative because of memory constraints. */ before = after = NULL; for (i = 0; i < n_operands; i++) @@ -4470,17 +4477,9 @@ curr_insn_transform (bool check_only_p) we chose previously may no longer be valid. */ lra_set_used_insn_alternative (curr_insn, LRA_UNKNOWN_ALT); - if (! check_only_p) - { - if (bitmap_bit_p (&lra_postponed_insns, INSN_UID (curr_insn))) - /* Processing insn constraints were postponed. Do nothing, the insn - will be processed on the next constraint sub-pass after assignment - of reload pseudos in the insn. */ - return true; - if (curr_insn_set != NULL_RTX - && check_and_process_move (&change_p, &sec_mem_p)) - return change_p; - } + if (! check_only_p && curr_insn_set != NULL_RTX + && check_and_process_move (&change_p, &sec_mem_p)) + return change_p; try_swapped:
