https://gcc.gnu.org/g:3050eeeee4183b9723a1465552b5798a1c21d223
commit r17-531-g3050eeeee4183b9723a1465552b5798a1c21d223 Author: H.J. Lu <[email protected]> Date: Fri May 15 08:01:56 2026 +0800 caller_save_regs: Return the enabled registers Since the caller can save a register only if the register is enabled in the caller, change caller_save_regs to return the enabled registers. PR rtl-optimization/125321 * function-abi.cc (function_abi_aggregator::caller_save_regs): Return the enabled registers. Signed-off-by: H.J. Lu <[email protected]> Diff: --- gcc/function-abi.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/function-abi.cc b/gcc/function-abi.cc index df1d2e5765b8..53a76dc2341d 100644 --- a/gcc/function-abi.cc +++ b/gcc/function-abi.cc @@ -159,7 +159,10 @@ caller_save_regs (const function_abi &caller_abi) const clobbers for (e.g. taking -fipa-ra into account). */ result |= (extra_clobbers & m_abi_clobbers[abi_id]); } - return result; + + /* The caller can save a register only if the register is enabled in + the caller. */ + return result & accessible_reg_set; } /* Return the set of registers that cannot be used to hold a value of
