On 10/26/26 11:38 PM, Max Filippov wrote:
> On Mon, Oct 26, 2026 at 5:53 AM <[email protected]> wrote:
>> From: Loeka Rogge <[email protected]>
>>
>> This was already added in the xtensa backend. Without the check,
>> reg_renumber[REGNO (x)] >= 0 could dereference null if true_regnum
>> is called before reload.
>>
>> Moved here so it can be reused in the RISC-V backend in the fusion
>> matchers in riscv-fusion.cc
>>
>> Bootstrapped and regtested with all checking enabled on x86.
>>
>> gcc/ChangeLog:
>>
>>          * config/xtensa/xtensa.cc (xt_true_regnum): Removed.
>>          (xtensa_valid_move): Use true_regnum instead of xt version.
>>          (print_operand): Likewise.
>>          (xtensa_secondary_reload): Likewise.
>>          * jump.cc (true_regnum): Replaced by xt version.
>>
>> Signed-off-by: Loeka Rogge <[email protected]>
>> ---
>>   gcc/config/xtensa/xtensa.cc | 48 ++++---------------------------------
>>   gcc/jump.cc                 | 14 +++++++----
>>   2 files changed, 14 insertions(+), 48 deletions(-)
> There are two more places where xt_true_regnum() is used in the
> xtensa print_operand(), with these fixed the change passes tests
> for xtensa without regressions and the xtensa part of this change
> is ok for master.
>
> --
> Thanks.
> -- Max

Thanks for pointing that out. I've sent a v2 with that fixed,
but I seem to have messed up the thread.
Subject: [PATCH v2] Add null check reg_renumber in true_regnum

Loeka

Reply via email to