[PR,57812] Wasted work in computed_jump_p()
diff mbox

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

Commit Message

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

The problem appears in revision 201034 in version 4.9. I also reported
this problem at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57812.

Bootstrap and regression-tested on x86_64-linux.

In method "computed_jump_p()" in gcc/rtlanal.c, the loop on line 2801
should break immediately after "has_use_labelref" is set to "1".


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

        * rtlanal.c (computed_jump_p): Exit loop once we find label
          reference is used.



-Chang
Index: gcc/rtlanal.c
===================================================================
--- gcc/rtlanal.c	(revision 201034)
+++ gcc/rtlanal.c	(working copy)
@@ -2802,7 +2802,10 @@
 	    if (GET_CODE (XVECEXP (pat, 0, i)) == USE
 		&& (GET_CODE (XEXP (XVECEXP (pat, 0, i), 0))
 		    == LABEL_REF))
-	      has_use_labelref = 1;
+	      {
+	        has_use_labelref = 1;
+	        break;
+	      }
 
 	  if (! has_use_labelref)
 	    for (i = len - 1; i >= 0; i--)

Comments

Chung-Ju Wu July 23, 2013, 4:58 a.m. UTC | #1
2013/7/23  <pchang9@cs.wisc.edu>:
>
> 2013-07-22  Chang  <pchang9@cs.wisc.edu>
>
>         * rtlanal.c (computed_jump_p): Exit loop once we find label
>           reference is used.
>

The second line is supposed to be aligned with '*' character at first line.
Like this:

	* rtlanal.c (computed_jump_p): Exit loop once we find label
	reference is used.


Best regards,
jasonwucj

Patch
diff mbox

Index: gcc/rtlanal.c
===================================================================
--- gcc/rtlanal.c	(revision 201034)
+++ gcc/rtlanal.c	(working copy)
@@ -2802,7 +2802,10 @@ 
 	    if (GET_CODE (XVECEXP (pat, 0, i)) == USE
 		&& (GET_CODE (XEXP (XVECEXP (pat, 0, i), 0))
 		    == LABEL_REF))
-	      has_use_labelref = 1;
+	      {
+	        has_use_labelref = 1;
+	        break;
+	      }

 	  if (! has_use_labelref)
 	    for (i = len - 1; i >= 0; i--)