diff mbox

[PR,57811] Wasted work in find_reloads()

Message ID f6fa3dffff7104c33468fe621c337c72.squirrel@webmail.cs.wisc.edu
State New
Headers show

Commit Message

pchang9@cs.wisc.edu July 22, 2013, 4:39 p.m. UTC
Hi,

The problem appears in revision 201034 in version 4.9.  I attached
one-line patches that fixes it.  I also reported this problem
at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57811

Bootstrap and regression-tested on x86_64-linux.

In method "find_reloads()" in gcc/reload.c, the loop on line 3324  should
break immediately after "badop" is set to "1". Also, the loop on line 4641
 should break after "ok" is set to "0".


2013-07-22  Chang  <pchang9@cs.wisc.edu>

        * reload.c (find_reloads): Exit loop once we find this operand
          cannot be reloaded somehow for this alternative.

        * reload.c (find_reloads): Exit loop once we find a
          hard register.




-Chang
Index: gcc/reload.c
===================================================================
--- gcc/reload.c	(revision 201034)
+++ gcc/reload.c	(working copy)
@@ -3324,7 +3324,10 @@
 		      for (j = 0; j < i; j++)
 			if (this_alternative_matches[j]
 			    == this_alternative_matches[i])
-			  badop = 1;
+			  {
+			    badop = 1;
+			    break;
+			  }
 		    break;
 
 		  case 'p':
Index: gcc/reload.c
===================================================================
--- gcc/reload.c	(revision 201034)
+++ gcc/reload.c	(working copy)
@@ -4640,7 +4640,10 @@
 
 	    for (nri = 1; nri < nr; nri ++)
 	      if (! TEST_HARD_REG_BIT (reg_class_contents[rld[i].rclass], regno + nri))
-		ok = 0;
+		{
+		  ok = 0;
+		  break;
+		}
 
 	    if (ok)
 	      rld[i].reg_rtx = dest;

Comments

Marek Polacek July 22, 2013, 4:50 p.m. UTC | #1
On Mon, Jul 22, 2013 at 11:39:38AM -0500, pchang9@cs.wisc.edu wrote:
> Hi,
> 
> The problem appears in revision 201034 in version 4.9.  I attached
> one-line patches that fixes it.  I also reported this problem
> at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57811
> 
> Bootstrap and regression-tested on x86_64-linux.
> 
> In method "find_reloads()" in gcc/reload.c, the loop on line 3324  should
> break immediately after "badop" is set to "1". Also, the loop on line 4641
>  should break after "ok" is set to "0".
> 
> 
> 2013-07-22  Chang  <pchang9@cs.wisc.edu>
> 
>         * reload.c (find_reloads): Exit loop once we find this operand
>           cannot be reloaded somehow for this alternative.
> 
>         * reload.c (find_reloads): Exit loop once we find a
>           hard register.

Perhaps just

2013-07-22  Chang  <pchang9@cs.wisc.edu>

	* reload.c (find_reloads): Exit loop after setting badop.
	Exit loop after setting ok.

Otherwise looks ok, just note that your MTA mangled the second patch.

	Marek
Jeff Law July 23, 2013, 3:57 p.m. UTC | #2
On 07/22/2013 10:39 AM, pchang9@cs.wisc.edu wrote:
> Hi,
>
> The problem appears in revision 201034 in version 4.9.  I attached
> one-line patches that fixes it.  I also reported this problem
> at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57811
>
> Bootstrap and regression-tested on x86_64-linux.
>
> In method "find_reloads()" in gcc/reload.c, the loop on line 3324  should
> break immediately after "badop" is set to "1". Also, the loop on line 4641
>   should break after "ok" is set to "0".
>
>
> 2013-07-22  Chang  <pchang9@cs.wisc.edu>
>
>          * reload.c (find_reloads): Exit loop once we find this operand
>            cannot be reloaded somehow for this alternative.
>
>          * reload.c (find_reloads): Exit loop once we find a
>            hard register.
Thanks.  Installed.

jeff
diff mbox

Patch

Index: gcc/reload.c
===================================================================
--- gcc/reload.c	(revision 201034)
+++ gcc/reload.c	(working copy)
@@ -3324,7 +3324,10 @@ 
 		      for (j = 0; j < i; j++)
 			if (this_alternative_matches[j]
 			    == this_alternative_matches[i])
-			  badop = 1;
+			  {
+			    badop = 1;
+			    break;
+			  }
 		    break;

 		  case 'p':
Index: gcc/reload.c
===================================================================
--- gcc/reload.c	(revision 201034)
+++ gcc/reload.c	(working copy)
@@ -4640,7 +4640,10 @@ 

 	    for (nri = 1; nri < nr; nri ++)
 	      if (! TEST_HARD_REG_BIT (reg_class_contents[rld[i].rclass], regno
+ nri))
-		ok = 0;
+		{
+		  ok = 0;
+		  break;
+		}

 	    if (ok)
 	      rld[i].reg_rtx = dest;