public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] ira: update allocated_hardreg_p[] in improve_allocation() [PR110254]
@ 2023-07-21 10:13 Surya Kumari Jangala
  2023-08-01  5:20 ` [PING][PATCH] " Surya Kumari Jangala
  0 siblings, 1 reply; 4+ messages in thread
From: Surya Kumari Jangala @ 2023-07-21 10:13 UTC (permalink / raw)
  To: GCC Patches; +Cc: vmakarov, Peter Bergner

The improve_allocation() routine does not update the
allocated_hardreg_p[] array after an allocno is assigned a register.

If the register chosen in improve_allocation() is one that already has
been assigned to a conflicting allocno, then allocated_hardreg_p[]
already has the corresponding bit set to TRUE, so nothing needs to be
done.

But improve_allocation() can also choose a register that has not been
assigned to a conflicting allocno, and also has not been assigned to any
other allocno. In this case, allocated_hardreg_p[] has to be updated.

2023-07-21  Surya Kumari Jangala  <jskumari@linux.ibm.com>

gcc/
	PR rtl-optimization/PR110254
	* ira-color.cc (improve_allocation): Update array
---

diff --git a/gcc/ira-color.cc b/gcc/ira-color.cc
index 1fb2958bddd..5807d6d26f6 100644
--- a/gcc/ira-color.cc
+++ b/gcc/ira-color.cc
@@ -3340,6 +3340,10 @@ improve_allocation (void)
 	}
       /* Assign the best chosen hard register to A.  */
       ALLOCNO_HARD_REGNO (a) = best;
+
+      for (j = nregs - 1; j >= 0; j--)
+	allocated_hardreg_p[best + j] = true;
+
       if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL)
 	fprintf (ira_dump_file, "Assigning %d to a%dr%d\n",
 		 best, ALLOCNO_NUM (a), ALLOCNO_REGNO (a));

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PING][PATCH] ira: update allocated_hardreg_p[] in improve_allocation() [PR110254]
  2023-07-21 10:13 [PATCH] ira: update allocated_hardreg_p[] in improve_allocation() [PR110254] Surya Kumari Jangala
@ 2023-08-01  5:20 ` Surya Kumari Jangala
  2023-08-02 13:23   ` Vladimir Makarov
  0 siblings, 1 reply; 4+ messages in thread
From: Surya Kumari Jangala @ 2023-08-01  5:20 UTC (permalink / raw)
  To: GCC Patches; +Cc: vmakarov, Peter Bergner

Ping

On 21/07/23 3:43 pm, Surya Kumari Jangala via Gcc-patches wrote:
> The improve_allocation() routine does not update the
> allocated_hardreg_p[] array after an allocno is assigned a register.
> 
> If the register chosen in improve_allocation() is one that already has
> been assigned to a conflicting allocno, then allocated_hardreg_p[]
> already has the corresponding bit set to TRUE, so nothing needs to be
> done.
> 
> But improve_allocation() can also choose a register that has not been
> assigned to a conflicting allocno, and also has not been assigned to any
> other allocno. In this case, allocated_hardreg_p[] has to be updated.
> 
> 2023-07-21  Surya Kumari Jangala  <jskumari@linux.ibm.com>
> 
> gcc/
> 	PR rtl-optimization/PR110254
> 	* ira-color.cc (improve_allocation): Update array
> ---
> 
> diff --git a/gcc/ira-color.cc b/gcc/ira-color.cc
> index 1fb2958bddd..5807d6d26f6 100644
> --- a/gcc/ira-color.cc
> +++ b/gcc/ira-color.cc
> @@ -3340,6 +3340,10 @@ improve_allocation (void)
>  	}
>        /* Assign the best chosen hard register to A.  */
>        ALLOCNO_HARD_REGNO (a) = best;
> +
> +      for (j = nregs - 1; j >= 0; j--)
> +	allocated_hardreg_p[best + j] = true;
> +
>        if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL)
>  	fprintf (ira_dump_file, "Assigning %d to a%dr%d\n",
>  		 best, ALLOCNO_NUM (a), ALLOCNO_REGNO (a));

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PING][PATCH] ira: update allocated_hardreg_p[] in improve_allocation() [PR110254]
  2023-08-01  5:20 ` [PING][PATCH] " Surya Kumari Jangala
@ 2023-08-02 13:23   ` Vladimir Makarov
  2023-08-18 16:51     ` Peter Bergner
  0 siblings, 1 reply; 4+ messages in thread
From: Vladimir Makarov @ 2023-08-02 13:23 UTC (permalink / raw)
  To: Surya Kumari Jangala, GCC Patches; +Cc: Peter Bergner


On 8/1/23 01:20, Surya Kumari Jangala wrote:
> Ping
Sorry for delay with the answer. I was on vacation.
> On 21/07/23 3:43 pm, Surya Kumari Jangala via Gcc-patches wrote:
>> The improve_allocation() routine does not update the
>> allocated_hardreg_p[] array after an allocno is assigned a register.
>>
>> If the register chosen in improve_allocation() is one that already has
>> been assigned to a conflicting allocno, then allocated_hardreg_p[]
>> already has the corresponding bit set to TRUE, so nothing needs to be
>> done.
>>
>> But improve_allocation() can also choose a register that has not been
>> assigned to a conflicting allocno, and also has not been assigned to any
>> other allocno. In this case, allocated_hardreg_p[] has to be updated.
The patch is OK for me.  Thank you for finding and fixing this issue.
>> 2023-07-21  Surya Kumari Jangala  <jskumari@linux.ibm.com>
>>
>> gcc/
>> 	PR rtl-optimization/PR110254
>> 	* ira-color.cc (improve_allocation): Update array

I guess you missed the next line in the changelog.  I suspect it should 
be "Update array allocated_hard_reg_p."

Please, fix it before committing the patch.

>> ---
>>
>> diff --git a/gcc/ira-color.cc b/gcc/ira-color.cc
>> index 1fb2958bddd..5807d6d26f6 100644
>> --- a/gcc/ira-color.cc
>> +++ b/gcc/ira-color.cc
>> @@ -3340,6 +3340,10 @@ improve_allocation (void)
>>   	}
>>         /* Assign the best chosen hard register to A.  */
>>         ALLOCNO_HARD_REGNO (a) = best;
>> +
>> +      for (j = nregs - 1; j >= 0; j--)
>> +	allocated_hardreg_p[best + j] = true;
>> +
>>         if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL)
>>   	fprintf (ira_dump_file, "Assigning %d to a%dr%d\n",
>>   		 best, ALLOCNO_NUM (a), ALLOCNO_REGNO (a));


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PING][PATCH] ira: update allocated_hardreg_p[] in improve_allocation() [PR110254]
  2023-08-02 13:23   ` Vladimir Makarov
@ 2023-08-18 16:51     ` Peter Bergner
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Bergner @ 2023-08-18 16:51 UTC (permalink / raw)
  To: Vladimir Makarov, Surya Kumari Jangala, GCC Patches

On 8/2/23 8:23 AM, Vladimir Makarov wrote:
>>> gcc/
>>>     PR rtl-optimization/PR110254
>>>     * ira-color.cc (improve_allocation): Update array
> 
> I guess you missed the next line in the changelog.  I suspect it should be "Update array allocated_hard_reg_p."
> 
> Please, fix it before committing the patch.

Is this a fix we want backported?

Peter



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-18 16:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-21 10:13 [PATCH] ira: update allocated_hardreg_p[] in improve_allocation() [PR110254] Surya Kumari Jangala
2023-08-01  5:20 ` [PING][PATCH] " Surya Kumari Jangala
2023-08-02 13:23   ` Vladimir Makarov
2023-08-18 16:51     ` Peter Bergner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).