Patchwork [PR,57790] Waste work in can_move_insns_across()

login
register
mail settings
Submitter pchang9@cs.wisc.edu
Date July 22, 2013, 1:45 a.m.
Message ID <1626b073286a8667e702196e26bbf42a.squirrel@webmail.cs.wisc.edu>
Download mbox | patch
Permalink /patch/260555/
State New
Headers show

Comments

pchang9@cs.wisc.edu - July 22, 2013, 1:45 a.m.
Hi,

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

I bootstrapped and ran the regression tests for this patch on x86_64-linux
and all tests pass.

In method "can_move_insns_across()" in df-problems.c, the loop on line
4038 should break immediately after "fail" is set to 1. All the iterations
after "fail" set to 1 do not perform any useful work, at best they just
set "fail" again to 1.


-Chang
Index: gcc/df-problems.c
===================================================================
--- gcc/df-problems.c	(revision 201034)
+++ gcc/df-problems.c	(working copy)
@@ -4040,7 +4040,10 @@
 	  if (i < FIRST_PSEUDO_REGISTER
 	      && ! fixed_regs[i]
 	      && ! global_regs[i])
-	    fail = 1;
+	    {
+	      fail = 1;
+	      break;
+	    }
 	}
     }
Jeff Law - July 22, 2013, 1:46 p.m.
On 07/21/2013 07:45 PM, pchang9@cs.wisc.edu wrote:
> Hi,
>
> The problem appears in revision 201034 in version 4.9.  I attached a
> one-line patch that fixes it.  I also reported this problem
> at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57790
>
> I bootstrapped and ran the regression tests for this patch on x86_64-linux
> and all tests pass.
>
> In method "can_move_insns_across()" in df-problems.c, the loop on line
> 4038 should break immediately after "fail" is set to 1. All the iterations
> after "fail" set to 1 do not perform any useful work, at best they just
> set "fail" again to 1.
Thanks.  I'll install shortly.

In the future if you could also include a ChangeLog entry it would be 
appreciated.  It's format is pretty simple.  Here's the one I'll use for 
this change:

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

         * df-problems.c (can_move_insns_across): Exit loop once we
         find a non-fixed, non-global register.

Patch

Index: gcc/df-problems.c
===================================================================
--- gcc/df-problems.c	(revision 201034)
+++ gcc/df-problems.c	(working copy)
@@ -4040,7 +4040,10 @@ 
 	  if (i < FIRST_PSEUDO_REGISTER
 	      && ! fixed_regs[i]
 	      && ! global_regs[i])
-	    fail = 1;
+	    {
+	      fail = 1;
+	      break;
+	    }
 	}
     }