diff mbox

Clear BB_VISITED in bb-reorder

Message ID alpine.LSU.2.11.1610171426160.26629@t29.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Oct. 17, 2016, 12:26 p.m. UTC
$subject, applied as obvious.

Richard.

2016-10-17  Richard Biener  <rguenther@suse.de>

	* bb-reorder.c (reorder_basic_blocks_simple): Clear BB_VISITED
	before using it.

Comments

Thomas Schwinge Oct. 17, 2016, 1:12 p.m. UTC | #1
Hi!

On Mon, 17 Oct 2016 14:26:42 +0200 (CEST), Richard Biener <rguenther@suse.de> wrote:
> --- gcc/bb-reorder.c	(revision 241228)
> +++ gcc/bb-reorder.c	(working copy)
> @@ -2355,7 +2355,10 @@ reorder_basic_blocks_simple (void)
>       To start with, everything points to itself, nothing is assigned yet.  */
>  
>    FOR_ALL_BB_FN (bb, cfun)
> -    bb->aux = bb;
> +    {
> +      bb->aux = bb;
> +      bb->flags &= ~BB_VISITED;
> +    }
>  
>    EXIT_BLOCK_PTR_FOR_FN (cfun)->aux = 0;

"EXIT_BLOCK_PTR_FOR_FN (cfun)->flags &= ~BB_VISITED;" is not required
here, additionally?

Also, I see that in this file, pass_duplicate_computed_gotos::execute
does call clear_bb_flags to clear basic block flags -- but
reorder_basic_blocks_simple (cited above), called via
reorder_basic_blocks, called via pass_reorder_blocks::execute is part of
a different pass...


Grüße
 Thomas
Richard Biener Oct. 17, 2016, 1:17 p.m. UTC | #2
On Mon, Oct 17, 2016 at 3:12 PM, Thomas Schwinge
<thomas@codesourcery.com> wrote:
> Hi!
>
> On Mon, 17 Oct 2016 14:26:42 +0200 (CEST), Richard Biener <rguenther@suse.de> wrote:
>> --- gcc/bb-reorder.c  (revision 241228)
>> +++ gcc/bb-reorder.c  (working copy)
>> @@ -2355,7 +2355,10 @@ reorder_basic_blocks_simple (void)
>>       To start with, everything points to itself, nothing is assigned yet.  */
>>
>>    FOR_ALL_BB_FN (bb, cfun)
>> -    bb->aux = bb;
>> +    {
>> +      bb->aux = bb;
>> +      bb->flags &= ~BB_VISITED;
>> +    }
>>
>>    EXIT_BLOCK_PTR_FOR_FN (cfun)->aux = 0;
>
> "EXIT_BLOCK_PTR_FOR_FN (cfun)->flags &= ~BB_VISITED;" is not required
> here, additionally?

ALL_BB includes EXIT_BLOCK.

> Also, I see that in this file, pass_duplicate_computed_gotos::execute
> does call clear_bb_flags to clear basic block flags -- but
> reorder_basic_blocks_simple (cited above), called via
> reorder_basic_blocks, called via pass_reorder_blocks::execute is part of
> a different pass...

Yes, this file contains multiple passes.

Richard.

> Grüße
>  Thomas
Andrew Pinski Oct. 18, 2016, 5:44 a.m. UTC | #3
On Mon, Oct 17, 2016 at 5:26 AM, Richard Biener <rguenther@suse.de> wrote:
>
> $subject, applied as obvious.

I think you should do the same for the vectorizer too.  I noticed that
when testing the patch for loop splitting.

Thanks,
Andrew

>
> Richard.
>
> 2016-10-17  Richard Biener  <rguenther@suse.de>
>
>         * bb-reorder.c (reorder_basic_blocks_simple): Clear BB_VISITED
>         before using it.
>
> Index: gcc/bb-reorder.c
> ===================================================================
> --- gcc/bb-reorder.c    (revision 241228)
> +++ gcc/bb-reorder.c    (working copy)
> @@ -2355,7 +2355,10 @@ reorder_basic_blocks_simple (void)
>       To start with, everything points to itself, nothing is assigned yet.  */
>
>    FOR_ALL_BB_FN (bb, cfun)
> -    bb->aux = bb;
> +    {
> +      bb->aux = bb;
> +      bb->flags &= ~BB_VISITED;
> +    }
>
>    EXIT_BLOCK_PTR_FOR_FN (cfun)->aux = 0;
>
Richard Biener Oct. 18, 2016, 7:36 a.m. UTC | #4
On Mon, 17 Oct 2016, Andrew Pinski wrote:

> On Mon, Oct 17, 2016 at 5:26 AM, Richard Biener <rguenther@suse.de> wrote:
> >
> > $subject, applied as obvious.
> 
> I think you should do the same for the vectorizer too.  I noticed that
> when testing the patch for loop splitting.

Can't see where BB_VISITED is used by the vectorizer - can you point
me to that?

Thanks,
Richard.
 
> Thanks,
> Andrew
> 
> >
> > Richard.
> >
> > 2016-10-17  Richard Biener  <rguenther@suse.de>
> >
> >         * bb-reorder.c (reorder_basic_blocks_simple): Clear BB_VISITED
> >         before using it.
> >
> > Index: gcc/bb-reorder.c
> > ===================================================================
> > --- gcc/bb-reorder.c    (revision 241228)
> > +++ gcc/bb-reorder.c    (working copy)
> > @@ -2355,7 +2355,10 @@ reorder_basic_blocks_simple (void)
> >       To start with, everything points to itself, nothing is assigned yet.  */
> >
> >    FOR_ALL_BB_FN (bb, cfun)
> > -    bb->aux = bb;
> > +    {
> > +      bb->aux = bb;
> > +      bb->flags &= ~BB_VISITED;
> > +    }
> >
> >    EXIT_BLOCK_PTR_FOR_FN (cfun)->aux = 0;
> >
diff mbox

Patch

Index: gcc/bb-reorder.c
===================================================================
--- gcc/bb-reorder.c	(revision 241228)
+++ gcc/bb-reorder.c	(working copy)
@@ -2355,7 +2355,10 @@  reorder_basic_blocks_simple (void)
      To start with, everything points to itself, nothing is assigned yet.  */
 
   FOR_ALL_BB_FN (bb, cfun)
-    bb->aux = bb;
+    {
+      bb->aux = bb;
+      bb->flags &= ~BB_VISITED;
+    }
 
   EXIT_BLOCK_PTR_FOR_FN (cfun)->aux = 0;