diff mbox

Fix regno_in_use_p for RTL checking bootstrap (PR rtl-optimization/72821)

Message ID 20160806191131.GC14857@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Aug. 6, 2016, 7:11 p.m. UTC
On Wed, Aug 03, 2016 at 02:59:30PM -0400, Vladimir N Makarov wrote:
> --- lra-spills.c	(revision 239000)
> +++ lra-spills.c	(working copy)
> @@ -686,16 +686,40 @@ return_regno_p (unsigned int regno)
>    return false;
>  }
>  
> -/* Return true if REGNO is one of subsequent USE after INSN.  */
> +/* Return true if REGNO is in one of subsequent USE after INSN in the
> +   same BB.  */
>  static bool
>  regno_in_use_p (rtx_insn *insn, unsigned int regno)
>  {
> +  static lra_insn_recog_data_t id;
> +  static struct lra_static_insn_data *static_id;
> +  struct lra_insn_reg *reg;
> +  int i, arg_regno;
> +  basic_block bb = BLOCK_FOR_INSN (insn);
> +
>    while ((insn = next_nondebug_insn (insn)) != NULL_RTX
> -	 && INSN_P (insn) && GET_CODE (PATTERN (insn)) == USE)
> +	 && bb == BLOCK_FOR_INSN (insn))

This broke rtl checking bootstrap, because BLOCK_FOR_INSN can't be used on
BARRIERs.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2016-08-06  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/72821
	* lra-spills.c (regno_in_use_p): Don't use BLOCK_FOR_INSN on barriers,
	just return false for them.


	Jakub

Comments

Vladimir Makarov Aug. 8, 2016, 1:41 p.m. UTC | #1
On 08/06/2016 03:11 PM, Jakub Jelinek wrote:
> On Wed, Aug 03, 2016 at 02:59:30PM -0400, Vladimir N Makarov wrote:
>> --- lra-spills.c	(revision 239000)
>> +++ lra-spills.c	(working copy)
>> @@ -686,16 +686,40 @@ return_regno_p (unsigned int regno)
>>     return false;
>>   }
>>   
>> -/* Return true if REGNO is one of subsequent USE after INSN.  */
>> +/* Return true if REGNO is in one of subsequent USE after INSN in the
>> +   same BB.  */
>>   static bool
>>   regno_in_use_p (rtx_insn *insn, unsigned int regno)
>>   {
>> +  static lra_insn_recog_data_t id;
>> +  static struct lra_static_insn_data *static_id;
>> +  struct lra_insn_reg *reg;
>> +  int i, arg_regno;
>> +  basic_block bb = BLOCK_FOR_INSN (insn);
>> +
>>     while ((insn = next_nondebug_insn (insn)) != NULL_RTX
>> -	 && INSN_P (insn) && GET_CODE (PATTERN (insn)) == USE)
>> +	 && bb == BLOCK_FOR_INSN (insn))
> This broke rtl checking bootstrap, because BLOCK_FOR_INSN can't be used on
> BARRIERs.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
>
>
Sure, Jakub.  Thank you fixing it.
diff mbox

Patch

--- gcc/lra-spills.c.jj	2016-08-06 12:11:49.000000000 +0200
+++ gcc/lra-spills.c	2016-08-06 14:05:22.751688854 +0200
@@ -697,9 +697,10 @@  regno_in_use_p (rtx_insn *insn, unsigned
   int i, arg_regno;
   basic_block bb = BLOCK_FOR_INSN (insn);
 
-  while ((insn = next_nondebug_insn (insn)) != NULL_RTX
-	 && bb == BLOCK_FOR_INSN (insn))
+  while ((insn = next_nondebug_insn (insn)) != NULL_RTX)
     {
+      if (BARRIER_P (insn) || bb != BLOCK_FOR_INSN (insn))
+	return false;
       if (! INSN_P (insn))
 	continue;
       if (GET_CODE (PATTERN (insn)) == USE