On 10/10/24 14:32, Denis Chertykov wrote:

The patch is very simple.
On x86_64, it bootstraps+regtests fine.
Ok for trunk?

Sorry for the delay with the answer. I missed your patch and pinging it was the right thing to do.

Thanks for the detail explanation of the problem which makes me easy to approve your patch.

I don't expect that the patch will create some problems for other targets, but LRA patch behavior prediction can be very tricky.  So please still pay attention for possible issues on the other targets for couple days.

The patch is ok to commit to the trunk.  Thank you for the patch, Denis.



    PR target/116550
gcc/
    * lra-constraints.cc (get_reload_reg): Reuse scratch registers
    generated by LRA.


diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc
index fdcc07764a2..1f63113f321 100644
--- a/gcc/lra-constraints.cc
+++ b/gcc/lra-constraints.cc
@@ -680,7 +680,8 @@ get_reload_reg (enum op_type type, machine_mode mode, rtx original,
      used by reload instructions.  */
       if (REG_P (original)
       && (int) REGNO (original) >= new_regno_start
-      && INSN_UID (curr_insn) >= new_insn_uid_start
+      && (INSN_UID (curr_insn) >= new_insn_uid_start
+          || ira_former_scratch_p (REGNO (original)))
       && in_class_p (original, rclass, &new_class, true))
     {
       unsigned int regno = REGNO (original);


Reply via email to