Avoid unnecesary rescaning in IRA

H.J. Lu hjl.tools@gmail.com
Thu Oct 16 07:08:00 GMT 2008


On Sat, Sep 27, 2008 at 6:56 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Sat, Sep 27, 2008 at 8:48 AM, Jan Hubicka <jh@suse.cz> wrote:
>> Hi,
>> while profiling large testcase I noticed that most of insn rescans come
>> from change_loop that is doing update because change_regs returns true
>> even for replacement of register by itself.
>> Bootstrapped/regtested i686-linux, OK?
>
> Ok.

I applied this patch in ira-merge branch on Sep. 30. There is no regression on
Linux/ia32, Linux/ia64 and Linux/Intel64.  I will check it into trunk.


H.J.
> Thanks,
> Richard.
>
>>        * ira-emit.c (change_regs): Return false when replacing reg by itself.
>> Index: ira-emit.c
>> ===================================================================
>> --- ira-emit.c  (revision 140713)
>> +++ ira-emit.c  (working copy)
>> @@ -137,6 +137,7 @@ change_regs (rtx *loc)
>>   int i, regno, result = false;
>>   const char *fmt;
>>   enum rtx_code code;
>> +  rtx reg;
>>
>>   if (*loc == NULL_RTX)
>>     return false;
>> @@ -151,7 +152,10 @@ change_regs (rtx *loc)
>>        return false;
>>       if (ira_curr_regno_allocno_map[regno] == NULL)
>>        return false;
>> -      *loc = ALLOCNO_REG (ira_curr_regno_allocno_map[regno]);
>> +      reg = ALLOCNO_REG (ira_curr_regno_allocno_map[regno]);
>> +      if (reg == *loc)
>> +       return false;
>> +      *loc = reg;
>>       return true;
>>     }
>>
>>
>



-- 
H.J.



More information about the Gcc-patches mailing list