Patchwork a tiny LRA patch

login
register
mail settings
Submitter Vladimir Makarov
Date May 10, 2013, 3:53 p.m.
Message ID <518D17F4.3020707@redhat.com>
Download mbox | patch
Permalink /patch/243013/
State New
Headers show

Comments

Vladimir Makarov - May 10, 2013, 3:53 p.m.
Analyzing code generated for PPC with LRA, I found that sometimes 
call-saved registers are overused.  It creates long prologs/epilogs.  
The following patch fixes it.

The problem was in that BB frequency might be zero.

Committed to trunk as rev. 198792.

The same patch was committed into lra-mike branch.

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

         * lra-assigns.c (find_hard_regno_for): Add 1 to the cost of call
         saved registers.

               || (hard_regno_costs[hard_regno] == best_cost

Patch

Index: lra-assigns.c
===================================================================
--- lra-assigns.c       (revision 198780)
+++ lra-assigns.c       (working copy)
@@ -598,7 +598,7 @@  find_hard_regno_for (int regno, int *cos
                 && ! df_regs_ever_live_p (hard_regno + j))
               /* It needs save restore.  */
               hard_regno_costs[hard_regno]
-               += 2 * ENTRY_BLOCK_PTR->next_bb->frequency;
+               += 2 * ENTRY_BLOCK_PTR->next_bb->frequency + 1;
           priority = targetm.register_priority (hard_regno);
           if (best_hard_regno < 0 || hard_regno_costs[hard_regno] < 
best_cost