https://gcc.gnu.org/g:e1390c2c45186e4843b927e77a102d39a599374a
commit r16-1092-ge1390c2c45186e4843b927e77a102d39a599374a Author: H.J. Lu <hjl.to...@gmail.com> Date: Tue Jun 3 05:56:37 2025 +0800 Always add REG_CALL_DECL note for CALL Always add REG_CALL_DECL note for CALL so that get_call_fndecl works without -fipa-ra. PR other/120494 * calls.cc (expand_call): Always add REG_CALL_DECL note. (emit_library_call_value_1): Likewise. Signed-off-by: H.J. Lu <hjl.to...@gmail.com> Diff: --- gcc/calls.cc | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/gcc/calls.cc b/gcc/calls.cc index 164f3c515d95..e16190c12a63 100644 --- a/gcc/calls.cc +++ b/gcc/calls.cc @@ -3736,19 +3736,16 @@ expand_call (tree exp, rtx target, int ignore) next_arg_reg, valreg, old_inhibit_defer_pop, call_fusage, flags, args_so_far); - if (flag_ipa_ra) + rtx_call_insn *last; + rtx datum = NULL_RTX; + if (fndecl != NULL_TREE) { - rtx_call_insn *last; - rtx datum = NULL_RTX; - if (fndecl != NULL_TREE) - { - datum = XEXP (DECL_RTL (fndecl), 0); - gcc_assert (datum != NULL_RTX - && GET_CODE (datum) == SYMBOL_REF); - } - last = last_call_insn (); - add_reg_note (last, REG_CALL_DECL, datum); + datum = XEXP (DECL_RTL (fndecl), 0); + gcc_assert (datum != NULL_RTX + && GET_CODE (datum) == SYMBOL_REF); } + last = last_call_insn (); + add_reg_note (last, REG_CALL_DECL, datum); /* If the call setup or the call itself overlaps with anything of the argument setup we probably clobbered our call address. @@ -4804,13 +4801,10 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, struct_value_size, call_cookie, valreg, old_inhibit_defer_pop + 1, call_fusage, flags, args_so_far); - if (flag_ipa_ra) - { - rtx datum = orgfun; - gcc_assert (GET_CODE (datum) == SYMBOL_REF); - rtx_call_insn *last = last_call_insn (); - add_reg_note (last, REG_CALL_DECL, datum); - } + rtx datum = orgfun; + gcc_assert (GET_CODE (datum) == SYMBOL_REF); + rtx_call_insn *last = last_call_insn (); + add_reg_note (last, REG_CALL_DECL, datum); /* Right-shift returned value if necessary. */ if (!pcc_struct_value