[PR,57782] Wasted work in remove_path()
diff mbox

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

Commit Message

pchang9@cs.wisc.edu July 22, 2013, 9:59 p.m. UTC
Hi,

The problem appears in revision 200945 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=57782

In method "remove_path()" in cfgloopmanip.c, the loop on line 343
should break immediately after "irred_invalidated" is set to "true".


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

        * cfgloopmanip.c (remove_path): Exit loop after
        setting irred_invalidated.




-Chang
Index: gcc/cfgloopmanip.c
===================================================================
--- gcc/cfgloopmanip.c	(revision 201034)
+++ gcc/cfgloopmanip.c	(working copy)
@@ -343,7 +343,11 @@
     FOR_EACH_EDGE (ae, ei, e->src->succs)
       if (ae != e && ae->dest != EXIT_BLOCK_PTR && !bitmap_bit_p (seen, ae->dest->index)
 	  && ae->flags & EDGE_IRREDUCIBLE_LOOP)
-	irred_invalidated = true;
+	{
+	  irred_invalidated = true;
+	  break;
+	}
+
   for (i = 0; i < nrem; i++)
     {
       bb = rem_bbs[i];

Comments

Jeff Law July 23, 2013, 3:59 p.m. UTC | #1
On 07/22/2013 03:59 PM, pchang9@cs.wisc.edu wrote:
> Hi,
>
> The problem appears in revision 200945 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=57782
>
> In method "remove_path()" in cfgloopmanip.c, the loop on line 343
> should break immediately after "irred_invalidated" is set to "true".
>
>
> 2013-07-22  Chang  <pchang9@cs.wisc.edu>
>
>          * cfgloopmanip.c (remove_path): Exit loop after
>          setting irred_invalidated.
Thanks.  Installed.
jeff

Patch
diff mbox

Index: gcc/cfgloopmanip.c
===================================================================
--- gcc/cfgloopmanip.c	(revision 201034)
+++ gcc/cfgloopmanip.c	(working copy)
@@ -343,7 +343,11 @@ 
     FOR_EACH_EDGE (ae, ei, e->src->succs)
       if (ae != e && ae->dest != EXIT_BLOCK_PTR && !bitmap_bit_p (seen,  ae->dest->index)
 	  && ae->flags & EDGE_IRREDUCIBLE_LOOP)
-	irred_invalidated = true;
+	{
+	  irred_invalidated = true;
+	  break;
+	}
+
   for (i = 0; i < nrem; i++)
     {
       bb = rem_bbs[i];