On 2026/09/29 18:33, Max Filippov wrote:
On Mon, Sep 28, 2026 at 10:00 AM Alexey Lapshin
<[email protected]> wrote:

xt_true_regnum is used by move expanders and insn conditions, which
IRA invokes through emit_move_insn and recog_memoized when emitting
moves for regional allocation.  At that point reg_renumber has not
been resized to cover the new pseudos, so indexing it reads out of
bounds.  Before LRA starts reg_renumber holds no final assignments,
so only consult it once LRA is in progress or reload has completed.

gcc/ChangeLog:

         * config/xtensa/xtensa.cc (xt_true_regnum): Don't index
         reg_renumber before LRA starts.
---
  gcc/config/xtensa/xtensa.cc | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)

Regtested for target=xtensa-linux-uclibc, no new regressions.
Marked that it fixes PR target/107549 and committed to master.


This patch clearly targets the LRA transition code; so, wouldn't it be better 
to backport it to the releases following the transition to LRA - specifically 
GCC 14 through 16?

=====
mailto:[email protected]

Reply via email to