https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115042
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Vladimir Makarov <[email protected]>: https://gcc.gnu.org/g:958d1a881940c6551757958e9da27597420a6d52 commit r16-7879-g958d1a881940c6551757958e9da27597420a6d52 Author: Vladimir N. Makarov <[email protected]> Date: Tue Mar 3 15:24:39 2026 -0500 [PR115042, LRA]: Postpone processing of new reload insns, 2nd variant This is the second attempt to solve the PR. The first attempt (see commit 9a7da540b63e7d77e747b5cdd6fdbbd3954e28c8) resulted in numerous test suite failures on some secondary targets. LRA in this PR can not find regs for asm insn which requires 11 general regs when 13 regs are available. Arm subtarget (thumb) has two stores with low and high general regs. LRA systematically chooses stores involving low regs as having less costs and there are only 8 low regs. That is because LRA (and reload) chooses (mov) insn alternatives independently from register pressure. The proposed patch postpones processing new reload insns until the reload pseudos are assigned and after that considers new reload insns. We postpone reloads only for asm insns as they can have a lot of operands. Depending on the assignment LRA chooses insns involving low or high regs. Generally speaking it can change code generation in better or worse way but it should be a very rare case. The patch does not contain the test as original test is too big (300KB of C code). Unfortunately cvise after 2 days of work managed to decrease the test only to 100KB file. gcc/ChangeLog: PR target/115042 * lra-int.h (lra_postponed_insns): New. * lra.cc (lra_set_insn_deleted, lra_asm_insn_error): Clear postponed insn flag. (lra_process_new_insns): Propagate postponed insn flag for asm gotos. (lra_postponed_insns): New. (lra): Initialize lra_postponed_insns. Push postponed insns on the stack. * lra-constraints.cc (postpone_insns): New function. (curr_insn_transform): Use it to postpone processing reload insn constraints. Skip processing postponed insns.
