public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][IRA] Fix PR87871: [9 Regression] testcases fail after r265398 on arm
@ 2019-04-18 15:59 Peter Bergner
  2019-04-18 22:20 ` Vladimir Makarov
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Bergner @ 2019-04-18 15:59 UTC (permalink / raw)
  To: GCC Patches; +Cc: Vladimir N Makarov, Jeff Law

PR87871 exposes a couple of problems.  One problem fixed here is that IRA
incorrectly adds a conflict in some cases where we have a simple register
copy between a pseudo reg and a hard reg.  This stopped us from assigning
the pseudo reg to that hard reg which we wanted to do in the testsuite test
case shown in the bugzilla.  The bug is due to an oversight in my r264897
commit that added support for not adding conflicts for simple register
copies.  That code correctly didn't add a conflict to CONFLICT_HARD_REGS
in make_object_dead(), but failed to do the same for TOTAL_CONFLICT_HARD_REGS.
The patch below fixes that oversight.

I have confirmed we now assign pseudo p116 to r0 in the ARM test case
as well as a similar assignment issue on POWER.

This passed bootstrap and regtesting with no regressions on powerpc64le-linux.
Ok for mainline?

Peter

	PR rtl-optimization/87871
	* ira-lives.c (make_object_dead): Don't add conflicts to
	TOTAL_CONFLICT_HARD_REGS for register ignore_reg_for_conflicts.

Index: gcc/ira-lives.c
===================================================================
--- gcc/ira-lives.c	(revision 270420)
+++ gcc/ira-lives.c	(working copy)
@@ -163,7 +163,9 @@ static void
 make_object_dead (ira_object_t obj)
 {
   live_range_t lr;
+  int regno;
   int ignore_regno = -1;
+  int ignore_total_regno = -1;
   int end_regno = -1;
 
   sparseset_clear_bit (objects_live, OBJECT_CONFLICT_ID (obj));
@@ -174,16 +176,14 @@ make_object_dead (ira_object_t obj)
       && REGNO (ignore_reg_for_conflicts) < FIRST_PSEUDO_REGISTER)
     {
       end_regno = END_REGNO (ignore_reg_for_conflicts);
-      int src_regno = ignore_regno = REGNO (ignore_reg_for_conflicts);
+      ignore_regno = ignore_total_regno = REGNO (ignore_reg_for_conflicts);
 
-      while (src_regno < end_regno)
+      for (regno = ignore_regno; regno < end_regno; regno++)
 	{
-	  if (TEST_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), src_regno))
-	    {
-	      ignore_regno = end_regno = -1;
-	      break;
-	    }
-	  src_regno++;
+	  if (TEST_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno))
+	    ignore_regno = end_regno;
+	  if (TEST_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), regno))
+	    ignore_total_regno = end_regno;
 	}
     }
 
@@ -192,8 +192,10 @@ make_object_dead (ira_object_t obj)
 
   /* If IGNORE_REG_FOR_CONFLICTS did not already conflict with OBJ, make
      sure it still doesn't.  */
-  for (; ignore_regno < end_regno; ignore_regno++)
-    CLEAR_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), ignore_regno);
+  for (regno = ignore_regno; regno < end_regno; regno++)
+    CLEAR_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno);
+  for (regno = ignore_total_regno; regno < end_regno; regno++)
+    CLEAR_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), regno);
 
   lr = OBJECT_LIVE_RANGES (obj);
   ira_assert (lr != NULL);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][IRA] Fix PR87871: [9 Regression] testcases fail after r265398 on arm
  2019-04-18 15:59 [PATCH][IRA] Fix PR87871: [9 Regression] testcases fail after r265398 on arm Peter Bergner
@ 2019-04-18 22:20 ` Vladimir Makarov
  2019-04-19  0:02   ` Peter Bergner
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Makarov @ 2019-04-18 22:20 UTC (permalink / raw)
  To: Peter Bergner, GCC Patches; +Cc: Jeff Law


On 4/18/19 11:24 AM, Peter Bergner wrote:
> PR87871 exposes a couple of problems.  One problem fixed here is that IRA
> incorrectly adds a conflict in some cases where we have a simple register
> copy between a pseudo reg and a hard reg.  This stopped us from assigning
> the pseudo reg to that hard reg which we wanted to do in the testsuite test
> case shown in the bugzilla.  The bug is due to an oversight in my r264897
> commit that added support for not adding conflicts for simple register
> copies.  That code correctly didn't add a conflict to CONFLICT_HARD_REGS
> in make_object_dead(), but failed to do the same for TOTAL_CONFLICT_HARD_REGS.
> The patch below fixes that oversight.
>
> I have confirmed we now assign pseudo p116 to r0 in the ARM test case
> as well as a similar assignment issue on POWER.
>
> This passed bootstrap and regtesting with no regressions on powerpc64le-linux.
> Ok for mainline?


Ok.  Thank you for fixing this, Peter.  Although I don't expect any 
problems with the patch.  Still please prepare to revert the patch if 
something goes wrong.


> Peter
>
> 	PR rtl-optimization/87871
> 	* ira-lives.c (make_object_dead): Don't add conflicts to
> 	TOTAL_CONFLICT_HARD_REGS for register ignore_reg_for_conflicts.
>
> Index: gcc/ira-lives.c
> ===================================================================
> --- gcc/ira-lives.c	(revision 270420)
> +++ gcc/ira-lives.c	(working copy)
> @@ -163,7 +163,9 @@ static void
>   make_object_dead (ira_object_t obj)
>   {
>     live_range_t lr;
> +  int regno;
>     int ignore_regno = -1;
> +  int ignore_total_regno = -1;
>     int end_regno = -1;
>   
>     sparseset_clear_bit (objects_live, OBJECT_CONFLICT_ID (obj));
> @@ -174,16 +176,14 @@ make_object_dead (ira_object_t obj)
>         && REGNO (ignore_reg_for_conflicts) < FIRST_PSEUDO_REGISTER)
>       {
>         end_regno = END_REGNO (ignore_reg_for_conflicts);
> -      int src_regno = ignore_regno = REGNO (ignore_reg_for_conflicts);
> +      ignore_regno = ignore_total_regno = REGNO (ignore_reg_for_conflicts);
>   
> -      while (src_regno < end_regno)
> +      for (regno = ignore_regno; regno < end_regno; regno++)
>   	{
> -	  if (TEST_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), src_regno))
> -	    {
> -	      ignore_regno = end_regno = -1;
> -	      break;
> -	    }
> -	  src_regno++;
> +	  if (TEST_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno))
> +	    ignore_regno = end_regno;
> +	  if (TEST_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), regno))
> +	    ignore_total_regno = end_regno;
>   	}
>       }
>   
> @@ -192,8 +192,10 @@ make_object_dead (ira_object_t obj)
>   
>     /* If IGNORE_REG_FOR_CONFLICTS did not already conflict with OBJ, make
>        sure it still doesn't.  */
> -  for (; ignore_regno < end_regno; ignore_regno++)
> -    CLEAR_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), ignore_regno);
> +  for (regno = ignore_regno; regno < end_regno; regno++)
> +    CLEAR_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno);
> +  for (regno = ignore_total_regno; regno < end_regno; regno++)
> +    CLEAR_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), regno);
>   
>     lr = OBJECT_LIVE_RANGES (obj);
>     ira_assert (lr != NULL);
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][IRA] Fix PR87871: [9 Regression] testcases fail after r265398 on arm
  2019-04-18 22:20 ` Vladimir Makarov
@ 2019-04-19  0:02   ` Peter Bergner
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Bergner @ 2019-04-19  0:02 UTC (permalink / raw)
  To: Vladimir Makarov; +Cc: GCC Patches, Jeff Law

On 4/18/19 4:39 PM, Vladimir Makarov wrote:
> On 4/18/19 11:24 AM, Peter Bergner wrote:
>> I have confirmed we now assign pseudo p116 to r0 in the ARM test case
>> as well as a similar assignment issue on POWER.
>>
>> This passed bootstrap and regtesting with no regressions on powerpc64le-linux.
>> Ok for mainline?
> 
> 
> Ok.  Thank you for fixing this, Peter.

Ok, committed.  Thanks!



> Although I don't expect any problems with the patch.  Still please prepare
> to revert the patch if something goes wrong.

Will do.


Peter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-18 22:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-18 15:59 [PATCH][IRA] Fix PR87871: [9 Regression] testcases fail after r265398 on arm Peter Bergner
2019-04-18 22:20 ` Vladimir Makarov
2019-04-19  0:02   ` Peter Bergner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).