diff mbox

Enhance reload_cse_move2add

Message ID AANLkTik4NZtY7sde62cax3kslmQCnuPhmokoKGTJZLVE@mail.gmail.com
State New
Headers show

Commit Message

H.J. Lu July 12, 2010, 6:44 p.m. UTC
On Mon, Jul 12, 2010 at 11:38 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Jul 12, 2010 at 11:36 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Mon, Jul 12, 2010 at 10:41 AM, Jie Zhang <jie@codesourcery.com> wrote:
>>> On 07/13/2010 12:37 AM, Jeff Law wrote:
>>>>
>>>> On 06/30/10 01:45, Jie Zhang wrote:
>>>>>
>>>>> Currently reload_cse_move2add can transform
>>>>>
>>>>> (set (REGX) (CONST_INT A))
>>>>> ...
>>>>> (set (REGX) (CONST_INT B))
>>>>>
>>>>> to
>>>>>
>>>>> (set (REGX) (CONST_INT A))
>>>>> ...
>>>>> (set (REGX) (plus (REGX) (CONST_INT B-A)))
>>>>>
>>>>> This patch enhances it to be able to transform
>>>>>
>>>>> (set (REGX) (CONST (PLUS (SYMBOL_REF) (CONST_INT A))))
>>>>> ...
>>>>> (set (REGY) (CONST (PLUS (SYMBOL_REF) (CONST_INT B))))
>>>>>
>>>>> to
>>>>>
>>>>> (set (REGX) (CONST (PLUS (SYMBOL_REF) (CONST_INT A))))
>>>>> ...
>>>>> (set (REGY) (CONST (PLUS (REGX) (CONST_INT B-A))))
>>>>>
>>>>>
>>>>> Benchmarking using EEMBC on ARM Cortex-A8 shows performance
>>>>> improvement on one test:
>>>>>
>>>>> idctrn01: 6%
>>>>>
>>>>> No meaningful changes on other tests.
>>>>>
>>>>> Benchmarking using SPEC2000 on AMD Athlon64 X2 3800+ shows 0.4%
>>>>> regression on CINT2000 and 0.1% improvement on CFP2000.
>>>>>
>>>>> Bootstrapped and regression tested on x86_64.
>>>>>
>>>>> Is it OK?
>>>>
>>>> Thanks for your patience, particularly when my requests for additional
>>>> data. I think we're OK with the benchmarking #s, particularly looking at
>>>> the amount of noise in the runs we're seeing for x86_64.
>>>>
>>>> Appoved,
>>>>
>>> Jeff,
>>>
>>> Thanks! I learned a lot during the procedure.
>>>
>>> On 07/10/2010 08:06 AM, Bernd Schmidt wrote:
>>>> So what kinds of changes are there that would explain a 1.48% drop on
>>>> 179.art?  If you can verify that the code is in fact identical, and the
>>>> performance change is noise, the patch is ok.
>>>>
>>> Bernd,
>>>
>>> I didn't realize it was a conditional approval until I asked you privately.
>>> Thanks!
>>>
>>>
>>> I have committed it on trunk.
>>>
>>
>> I think it breaks bootstrap on Linux/ia32:
>>
>> ../../src-trunk/gcc/postreload.c: In function 'reload_cse_regs':
>> ../../src-trunk/gcc/postreload.c:1327:57: error: 'min_regno' may be
>> used uninitialized in this function [-Werror=uninitialized]
>> ../../src-trunk/gcc/postreload.c:1284:7: note: 'min_regno' was declared here
>> cc1: all warnings being treated as errors
>>
>
> I opened:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44921
>
> --
> H.J.
>

This patch works for me.
diff mbox

Patch

Index: postreload.c
===================================================================
--- postreload.c	(revision 162085)
+++ postreload.c	(working copy)
@@ -1281,7 +1281,7 @@  move2add_use_add3_insn (rtx reg, rtx sym
   rtx src = SET_SRC (pat);
   int regno = REGNO (reg);
   int min_cost = INT_MAX;
-  int min_regno;
+  int min_regno = -1;
   bool speed = optimize_bb_for_speed_p (BLOCK_FOR_INSN (insn));
   int i;

@@ -1317,7 +1317,7 @@  move2add_use_add3_insn (rtx reg, rtx sym
 	  }
       }

-  if (min_cost < rtx_cost (src, SET, speed))
+  if (min_regno >= 0 && min_cost < rtx_cost (src, SET, speed))
     {
       rtx tem;