public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] rtl-optimization: Modify loop live data with livein of loop header
@ 2023-11-21  8:30 Ajit Agarwal
  2023-11-21  9:32 ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Ajit Agarwal @ 2023-11-21  8:30 UTC (permalink / raw)
  To: gcc-patches; +Cc: Richard Biener, Jeff Law, Segher Boessenkool, Peter Bergner

Hello All:

This patch marked LOOP_DATA->live as the livein at the loop header basic
block. This is because Livein at each basic block is live in at the loop header.

Bootstrapped and regtested on powerpc64-linux-gnu.

SPEC CPU 2017 benchmarks score is better than trunk wit this
change for INT and FP benchmarks.

THanks & Regards
Ajit


rtl-optimization: Modify loop live data with livein of loop header

Livein at each basic block is live in at the loop header.
Marked LOOP_DATA->live as the livein at the loop header basic
block.

2023-11-21  Ajit Kumar Agarwal  <aagarwa1@linux.ibm.com>

gcc/ChangeLog:

        * loop-invariant.cc (calculate_loop_reg_pressure): Mark
	LOOP_DATA->live as the livein at the loop header basic block.
---
 gcc/loop-invariant.cc | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gcc/loop-invariant.cc b/gcc/loop-invariant.cc
index a9b156682bc..c15e6168d5d 100644
--- a/gcc/loop-invariant.cc
+++ b/gcc/loop-invariant.cc
@@ -2169,17 +2169,18 @@ calculate_loop_reg_pressure (void)
       }
   ira_setup_eliminable_regset ();
   bitmap_initialize (&curr_regs_live, &reg_obstack);
+
+  /* Livein (loop_hdr) is live at each of the loop basic blocks.  */
+  for (auto loop : loops_list (cfun, 0))
+    if (loop->aux == NULL)
+      bitmap_ior_into (&LOOP_DATA (loop)->regs_live, DF_LR_IN (loop->header));
+
   FOR_EACH_BB_FN (bb, cfun)
     {
       curr_loop = bb->loop_father;
       if (curr_loop == current_loops->tree_root)
 	continue;
 
-      for (class loop *loop = curr_loop;
-	   loop != current_loops->tree_root;
-	   loop = loop_outer (loop))
-	bitmap_ior_into (&LOOP_DATA (loop)->regs_live, DF_LR_IN (bb));
-
       bitmap_copy (&curr_regs_live, DF_LR_IN (bb));
       for (i = 0; i < ira_pressure_classes_num; i++)
 	curr_reg_pressure[ira_pressure_classes[i]] = 0;
-- 
2.39.3


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

* Re: [PATCH] rtl-optimization: Modify loop live data with livein of loop header
  2023-11-21  8:30 [PATCH] rtl-optimization: Modify loop live data with livein of loop header Ajit Agarwal
@ 2023-11-21  9:32 ` Richard Biener
  2023-11-21  9:45   ` Ajit Agarwal
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2023-11-21  9:32 UTC (permalink / raw)
  To: Ajit Agarwal; +Cc: gcc-patches, Jeff Law, Segher Boessenkool, Peter Bergner

On Tue, Nov 21, 2023 at 9:30 AM Ajit Agarwal <aagarwa1@linux.ibm.com> wrote:
>
> Hello All:
>
> This patch marked LOOP_DATA->live as the livein at the loop header basic
> block. This is because Livein at each basic block is live in at the loop header.

The current code does the same, you now have fewer regs live.  In fact
your patch removes all of the settings since when
loop->aux == NULL there's no LOOP_DATA (loop), so you never do anything.

It appears that you do not fully grasp the changes done by your
patches - you need to improve
in this regard and either provide better explanations or stop sending these kind
of patches.

I will stop looking at your patches now, it appears to be a waste of
my precious time.

Peter - please work with Ajit here.

Thanks,
Richard.


> Bootstrapped and regtested on powerpc64-linux-gnu.
>
> SPEC CPU 2017 benchmarks score is better than trunk wit this
> change for INT and FP benchmarks.
>
> THanks & Regards
> Ajit
>
>
> rtl-optimization: Modify loop live data with livein of loop header
>
> Livein at each basic block is live in at the loop header.
> Marked LOOP_DATA->live as the livein at the loop header basic
> block.
>
> 2023-11-21  Ajit Kumar Agarwal  <aagarwa1@linux.ibm.com>
>
> gcc/ChangeLog:
>
>         * loop-invariant.cc (calculate_loop_reg_pressure): Mark
>         LOOP_DATA->live as the livein at the loop header basic block.
> ---
>  gcc/loop-invariant.cc | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/gcc/loop-invariant.cc b/gcc/loop-invariant.cc
> index a9b156682bc..c15e6168d5d 100644
> --- a/gcc/loop-invariant.cc
> +++ b/gcc/loop-invariant.cc
> @@ -2169,17 +2169,18 @@ calculate_loop_reg_pressure (void)
>        }
>    ira_setup_eliminable_regset ();
>    bitmap_initialize (&curr_regs_live, &reg_obstack);
> +
> +  /* Livein (loop_hdr) is live at each of the loop basic blocks.  */
> +  for (auto loop : loops_list (cfun, 0))
> +    if (loop->aux == NULL)
> +      bitmap_ior_into (&LOOP_DATA (loop)->regs_live, DF_LR_IN (loop->header));
> +
>    FOR_EACH_BB_FN (bb, cfun)
>      {
>        curr_loop = bb->loop_father;
>        if (curr_loop == current_loops->tree_root)
>         continue;
>
> -      for (class loop *loop = curr_loop;
> -          loop != current_loops->tree_root;
> -          loop = loop_outer (loop))
> -       bitmap_ior_into (&LOOP_DATA (loop)->regs_live, DF_LR_IN (bb));
> -
>        bitmap_copy (&curr_regs_live, DF_LR_IN (bb));
>        for (i = 0; i < ira_pressure_classes_num; i++)
>         curr_reg_pressure[ira_pressure_classes[i]] = 0;
> --
> 2.39.3
>

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

* Re: [PATCH] rtl-optimization: Modify loop live data with livein of loop header
  2023-11-21  9:32 ` Richard Biener
@ 2023-11-21  9:45   ` Ajit Agarwal
  2023-11-21  9:52     ` Ajit Agarwal
  0 siblings, 1 reply; 4+ messages in thread
From: Ajit Agarwal @ 2023-11-21  9:45 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches, Jeff Law, Segher Boessenkool, Peter Bergner



On 21/11/23 3:02 pm, Richard Biener wrote:
> On Tue, Nov 21, 2023 at 9:30 AM Ajit Agarwal <aagarwa1@linux.ibm.com> wrote:
>>
>> Hello All:
>>
>> This patch marked LOOP_DATA->live as the livein at the loop header basic
>> block. This is because Livein at each basic block is live in at the loop header.
> 
> The current code does the same, you now have fewer regs live.  In fact
> your patch removes all of the settings since when
> loop->aux == NULL there's no LOOP_DATA (loop), so you never do anything.
> 

Sorry for the inconvenience caused. I forgot to remove the check loop-aux == NULL
in the patch that I sent.

My mistake. Sorry for that.

Thanks & Regards
Ajit
> It appears that you do not fully grasp the changes done by your
> patches - you need to improve
> in this regard and either provide better explanations or stop sending these kind
> of patches.
> 
> I will stop looking at your patches now, it appears to be a waste of
> my precious time.
> 
> Peter - please work with Ajit here.
> 
> Thanks,
> Richard.
> 
> 
>> Bootstrapped and regtested on powerpc64-linux-gnu.
>>
>> SPEC CPU 2017 benchmarks score is better than trunk wit this
>> change for INT and FP benchmarks.
>>
>> THanks & Regards
>> Ajit
>>
>>
>> rtl-optimization: Modify loop live data with livein of loop header
>>
>> Livein at each basic block is live in at the loop header.
>> Marked LOOP_DATA->live as the livein at the loop header basic
>> block.
>>
>> 2023-11-21  Ajit Kumar Agarwal  <aagarwa1@linux.ibm.com>
>>
>> gcc/ChangeLog:
>>
>>         * loop-invariant.cc (calculate_loop_reg_pressure): Mark
>>         LOOP_DATA->live as the livein at the loop header basic block.
>> ---
>>  gcc/loop-invariant.cc | 11 ++++++-----
>>  1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/gcc/loop-invariant.cc b/gcc/loop-invariant.cc
>> index a9b156682bc..c15e6168d5d 100644
>> --- a/gcc/loop-invariant.cc
>> +++ b/gcc/loop-invariant.cc
>> @@ -2169,17 +2169,18 @@ calculate_loop_reg_pressure (void)
>>        }
>>    ira_setup_eliminable_regset ();
>>    bitmap_initialize (&curr_regs_live, &reg_obstack);
>> +
>> +  /* Livein (loop_hdr) is live at each of the loop basic blocks.  */
>> +  for (auto loop : loops_list (cfun, 0))
>> +    if (loop->aux == NULL)
>> +      bitmap_ior_into (&LOOP_DATA (loop)->regs_live, DF_LR_IN (loop->header));
>> +
>>    FOR_EACH_BB_FN (bb, cfun)
>>      {
>>        curr_loop = bb->loop_father;
>>        if (curr_loop == current_loops->tree_root)
>>         continue;
>>
>> -      for (class loop *loop = curr_loop;
>> -          loop != current_loops->tree_root;
>> -          loop = loop_outer (loop))
>> -       bitmap_ior_into (&LOOP_DATA (loop)->regs_live, DF_LR_IN (bb));
>> -
>>        bitmap_copy (&curr_regs_live, DF_LR_IN (bb));
>>        for (i = 0; i < ira_pressure_classes_num; i++)
>>         curr_reg_pressure[ira_pressure_classes[i]] = 0;
>> --
>> 2.39.3
>>

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

* Re: [PATCH] rtl-optimization: Modify loop live data with livein of loop header
  2023-11-21  9:45   ` Ajit Agarwal
@ 2023-11-21  9:52     ` Ajit Agarwal
  0 siblings, 0 replies; 4+ messages in thread
From: Ajit Agarwal @ 2023-11-21  9:52 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches, Jeff Law, Segher Boessenkool, Peter Bergner



On 21/11/23 3:15 pm, Ajit Agarwal wrote:
> 
> 
> On 21/11/23 3:02 pm, Richard Biener wrote:
>> On Tue, Nov 21, 2023 at 9:30 AM Ajit Agarwal <aagarwa1@linux.ibm.com> wrote:
>>>
>>> Hello All:
>>>
>>> This patch marked LOOP_DATA->live as the livein at the loop header basic
>>> block. This is because Livein at each basic block is live in at the loop header.
>>
>> The current code does the same, you now have fewer regs live.  In fact
>> your patch removes all of the settings since when
>> loop->aux == NULL there's no LOOP_DATA (loop), so you never do anything.
>>
> 
> Sorry for the inconvenience caused. I forgot to remove the check loop-aux == NULL
> in the patch that I sent.
> 
> My mistake. Sorry for that.
> 
> Thanks & Regards
> Ajit

I did copy from one directory to another and forgot to remove loop->aux == NULL check
in the patch that I sent.

My mistake. But anyhow I have tested without that check.

Sorry for inconvenience caused. I will make sure this wont happen again in the future
patches.

Thanks & Regards
Ajit
>> It appears that you do not fully grasp the changes done by your
>> patches - you need to improve
>> in this regard and either provide better explanations or stop sending these kind
>> of patches.
>>
>> I will stop looking at your patches now, it appears to be a waste of
>> my precious time.
>>
>> Peter - please work with Ajit here.
>>
>> Thanks,
>> Richard.
>>
>>
>>> Bootstrapped and regtested on powerpc64-linux-gnu.
>>>
>>> SPEC CPU 2017 benchmarks score is better than trunk wit this
>>> change for INT and FP benchmarks.
>>>
>>> THanks & Regards
>>> Ajit
>>>
>>>
>>> rtl-optimization: Modify loop live data with livein of loop header
>>>
>>> Livein at each basic block is live in at the loop header.
>>> Marked LOOP_DATA->live as the livein at the loop header basic
>>> block.
>>>
>>> 2023-11-21  Ajit Kumar Agarwal  <aagarwa1@linux.ibm.com>
>>>
>>> gcc/ChangeLog:
>>>
>>>         * loop-invariant.cc (calculate_loop_reg_pressure): Mark
>>>         LOOP_DATA->live as the livein at the loop header basic block.
>>> ---
>>>  gcc/loop-invariant.cc | 11 ++++++-----
>>>  1 file changed, 6 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/gcc/loop-invariant.cc b/gcc/loop-invariant.cc
>>> index a9b156682bc..c15e6168d5d 100644
>>> --- a/gcc/loop-invariant.cc
>>> +++ b/gcc/loop-invariant.cc
>>> @@ -2169,17 +2169,18 @@ calculate_loop_reg_pressure (void)
>>>        }
>>>    ira_setup_eliminable_regset ();
>>>    bitmap_initialize (&curr_regs_live, &reg_obstack);
>>> +
>>> +  /* Livein (loop_hdr) is live at each of the loop basic blocks.  */
>>> +  for (auto loop : loops_list (cfun, 0))
>>> +    if (loop->aux == NULL)
>>> +      bitmap_ior_into (&LOOP_DATA (loop)->regs_live, DF_LR_IN (loop->header));
>>> +
>>>    FOR_EACH_BB_FN (bb, cfun)
>>>      {
>>>        curr_loop = bb->loop_father;
>>>        if (curr_loop == current_loops->tree_root)
>>>         continue;
>>>
>>> -      for (class loop *loop = curr_loop;
>>> -          loop != current_loops->tree_root;
>>> -          loop = loop_outer (loop))
>>> -       bitmap_ior_into (&LOOP_DATA (loop)->regs_live, DF_LR_IN (bb));
>>> -
>>>        bitmap_copy (&curr_regs_live, DF_LR_IN (bb));
>>>        for (i = 0; i < ira_pressure_classes_num; i++)
>>>         curr_reg_pressure[ira_pressure_classes[i]] = 0;
>>> --
>>> 2.39.3
>>>

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

end of thread, other threads:[~2023-11-21  9:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-21  8:30 [PATCH] rtl-optimization: Modify loop live data with livein of loop header Ajit Agarwal
2023-11-21  9:32 ` Richard Biener
2023-11-21  9:45   ` Ajit Agarwal
2023-11-21  9:52     ` Ajit Agarwal

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).