Patchwork patch for PR49865

login
register
mail settings
Submitter Vladimir Makarov
Date Dec. 20, 2011, 9:32 p.m.
Message ID <4EF0FEF9.4050007@redhat.com>
Download mbox | patch
Permalink /patch/132522/
State New
Headers show

Comments

Vladimir Makarov - Dec. 20, 2011, 9:32 p.m.
The following patch solves PR49865.  The problem is described on 
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49865

The patch changes code a bit only for gcc, crafty, and mesa on x86.  
There is no visible change in the performance.
Only code for crafty is changed on x86-64 and improvement in the 
performance is about 0.3%.

The patch was successfully bootstrapped on x86/x86-64.

The patch has been committed as rev. 182553.

2011-12-20  Vladimir Makarov <vmakarov@redhat.com>

         PR target/49865
         * ira-costs.c (find_costs_and_classes): Prefer registers even
           if the memory cost is the same.

Patch

Index: ira-costs.c
===================================================================
--- ira-costs.c	(revision 182552)
+++ ira-costs.c	(working copy)
@@ -1693,7 +1693,14 @@  find_costs_and_classes (FILE *dump_file)
 	      else if (i_costs[k] == best_cost)
 		best = ira_reg_class_subunion[best][rclass];
 	      if (pass == flag_expensive_optimizations
-		  && i_costs[k] < i_mem_cost
+		  /* We still prefer registers to memory even at this
+		     stage if their costs are the same.  We will make
+		     a final decision during assigning hard registers
+		     when we have all info including more accurate
+		     costs which might be affected by assigning hard
+		     registers to other pseudos because the pseudos
+		     involved in moves can be coalesced.  */
+		  && i_costs[k] <= i_mem_cost
 		  && (reg_class_size[reg_class_subunion[alt_class][rclass]]
 		      > reg_class_size[alt_class]))
 		alt_class = reg_class_subunion[alt_class][rclass];