Patchwork patch to add one more criterium for choosing alternatives in LRA

login
register
mail settings
Submitter Vladimir Makarov
Date May 2, 2013, 6:56 p.m.
Message ID <5182B6E9.30802@redhat.com>
Download mbox | patch
Permalink /patch/241055/
State New
Headers show

Comments

Vladimir Makarov - May 2, 2013, 6:56 p.m.
The following patch fixes two GCC testsuite failures on i686 after 
submitting patch to fix PR57091.

The first alternative is always preferable then subsequent ones when all 
costs are the same.  That is how reload works. This checks needs when we 
have commutative operator in an insn.

Committed as rev. 198558.

2013-05-02  Vladimir Makarov  <vmakarov@redhat.com>

         * lra-constraints.c (process_alt_operands): Add checking alt
         number to choose the best alternative.

Patch

Index: lra-constraints.c
===================================================================
--- lra-constraints.c   (revision 198503)
+++ lra-constraints.c   (working copy)
@@ -2197,7 +2197,9 @@  process_alt_operands (int only_alternati
                          number of reload regs.  */
                       && (reload_nregs < best_reload_nregs
                           || (reload_nregs == best_reload_nregs
-                             && best_reload_sum < reload_sum))))))
+                             && (best_reload_sum < reload_sum
+                                 || (best_reload_sum == reload_sum
+                                     && nalt < goal_alt_number))))))))
         {
           for (nop = 0; nop < n_operands; nop++)
             {