Mark accessible caller-saved registers as live to prevent IRA from generating invalid instructions when call_used_regs includes registers disabled by ISA selections.
PR rtl-optimization/125321 * ira.cc (update_equiv_regs_prescan): Mark a register as live only if it is accessible. -- H.J.
From 314a6328eb9bcdc9bbbd201f79fa8ab0a48c0f5e Mon Sep 17 00:00:00 2001 From: "H.J. Lu" <[email protected]> Date: Fri, 15 May 2026 08:01:56 +0800 Subject: [PATCH] ira: Mark a register as live only if it is accessible Mark accessible caller-saved registers as live to prevent IRA from generating invalid instructions when call_used_regs includes registers disabled by ISA selections. PR rtl-optimization/125321 * ira.cc (update_equiv_regs_prescan): Mark a register as live only if it is accessible. Signed-off-by: H.J. Lu <[email protected]> --- gcc/ira.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/ira.cc b/gcc/ira.cc index 85c7ec419b3..fdb4f66fb2f 100644 --- a/gcc/ira.cc +++ b/gcc/ira.cc @@ -3610,9 +3610,11 @@ update_equiv_regs_prescan (void) } HARD_REG_SET extra_caller_saves = callee_abis.caller_save_regs (*crtl->abi); + /* Mark a register as live only if it is accessible. */ if (!hard_reg_set_empty_p (extra_caller_saves)) for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno) - if (TEST_HARD_REG_BIT (extra_caller_saves, regno)) + if (TEST_HARD_REG_BIT (accessible_reg_set, regno) + && TEST_HARD_REG_BIT (extra_caller_saves, regno)) df_set_regs_ever_live (regno, true); } -- 2.54.0
