Patchwork patch to fix a bug in LRA hard reg splitting

login
register
mail settings
Submitter Vladimir Makarov
Date June 29, 2013, 12:37 a.m.
Message ID <51CE2C4C.8060700@redhat.com>
Download mbox | patch
Permalink /patch/255700/
State New
Headers show

Comments

Vladimir Makarov - June 29, 2013, 12:37 a.m.
On 13-06-28 3:47 PM, Vladimir Makarov wrote:
> On 13-06-27 12:22 PM, Vladimir Makarov wrote:
>> The following patch fixes a LRA bug for some experimental target.
>> Sorry, there is no a test case and the bug can not be reproduced by
>> other people until the target is made public.
>>
>>
> Here is one more fix for another hard reg splitting bug.
>
> The patch was successfully bootstrapped and tested on x86/x86-64.
>
> Committed as rev. 200553.
>
> 2013-06-28  Vladimir Makarov  <vmakarov@redhat.com>
>
>         * lra-constraints.c (need_for_split_p): Check call used hard regs
>         living through calls.
>
>
Sorry, I realized that the previous patch solves the problem in wrong 
way.  Here is the patch with the right solution.

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

Committed as rev. 200558.

2013-06-28  Vladimir Makarov  <vmakarov@redhat.com>

     Revert:
     2013-06-28  Vladimir Makarov <vmakarov@redhat.com>
     * lra-constraints.c (need_for_split_p): Check call used hard regs
     living through calls.

     * lra-constraints.c (inherit_in_ebb): Reset live_hard_regs for
     call used regs for call insn.

Patch

Index: lra-constraints.c
===================================================================
--- lra-constraints.c	(revision 200553)
+++ lra-constraints.c	(working copy)
@@ -4201,15 +4201,6 @@  need_for_split_p (HARD_REG_SET potential
 	   && (regno >= FIRST_PSEUDO_REGISTER
 	       || ! TEST_HARD_REG_BIT (eliminable_regset, hard_regno))
 	   && ! TEST_HARD_REG_BIT (lra_no_alloc_regs, hard_regno)
-	   /* Don't split call clobbered hard regs living through
-	      calls, otherwise we might have a check problem in the
-	      assign sub-pass as in the most cases (exception is a
-	      situation when lra_risky_transformations_p value is
-	      true) the assign pass assumes that all pseudos living
-	      through calls are assigned to call saved hard regs.  */
-	   && (regno >= FIRST_PSEUDO_REGISTER
-	       || ! TEST_HARD_REG_BIT (call_used_reg_set, regno)
-	       || usage_insns[regno].calls_num == calls_num)
 	   /* We need at least 2 reloads to make pseudo splitting
 	      profitable.  We should provide hard regno splitting in
 	      any case to solve 1st insn scheduling problem when
@@ -4887,6 +4878,7 @@  inherit_in_ebb (rtx head, rtx tail)
 		  usage_insns[regno].calls_num = calls_num;
 		  bitmap_set_bit (&check_only_regs, regno);
 		}
+	      AND_COMPL_HARD_REG_SET (live_hard_regs, call_used_reg_set);
 	    }
 	  to_inherit_num = 0;
 	  /* Process insn usages.  */