Use FOR_ALL_BB_FN in a few more places (was: [PATCH] Clear BB_VISITED in bb-reorder)

Thomas Schwinge thomas@codesourcery.com
Mon Oct 17 16:09:00 GMT 2016


Hi!

On Mon, 17 Oct 2016 15:17:13 +0200, Richard Biener <richard.guenther@gmail.com> wrote:
> On Mon, Oct 17, 2016 at 3:12 PM, Thomas Schwinge
> <thomas@codesourcery.com> wrote:
> > 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.

I see -- ;-) FOR_ALL_BB_FN is something different from FOR_EACH_BB_FN...


We could use the former in a few more places; OK for trunk once tested?

commit 183433526b2befb7bd75e74f753b8a5d4bec14b0
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Mon Oct 17 18:07:16 2016 +0200

    Use FOR_ALL_BB_FN in a few more places
    
    	gcc/
    	* cfg.c (clear_bb_flags): Use FOR_ALL_BB_FN.
    	* config/nvptx/nvptx.c (nvptx_find_sese): Likewise.
---
 gcc/cfg.c                | 2 +-
 gcc/config/nvptx/nvptx.c | 8 +-------
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git gcc/cfg.c gcc/cfg.c
index ee2e42c..6604b02 100644
--- gcc/cfg.c
+++ gcc/cfg.c
@@ -386,7 +386,7 @@ clear_bb_flags (void)
 {
   basic_block bb;
 
-  FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (cfun), NULL, next_bb)
+  FOR_ALL_BB_FN (bb, cfun)
     bb->flags &= BB_FLAGS_TO_PRESERVE;
 }
 

diff --git gcc/config/nvptx/nvptx.c gcc/config/nvptx/nvptx.c
index 6ec8eb4..80fa9ae 100644
--- gcc/config/nvptx/nvptx.c
+++ gcc/config/nvptx/nvptx.c
@@ -3091,17 +3091,11 @@ nvptx_find_sese (auto_vec<basic_block> &blocks, bb_pair_vec_t &regions)
   int ix;
 
   /* First clear each BB of the whole function.  */ 
-  FOR_EACH_BB_FN (block, cfun)
+  FOR_ALL_BB_FN (block, cfun)
     {
       block->flags &= ~BB_VISITED;
       BB_SET_SESE (block, 0);
     }
-  block = EXIT_BLOCK_PTR_FOR_FN (cfun);
-  block->flags &= ~BB_VISITED;
-  BB_SET_SESE (block, 0);
-  block = ENTRY_BLOCK_PTR_FOR_FN (cfun);
-  block->flags &= ~BB_VISITED;
-  BB_SET_SESE (block, 0);
 
   /* Mark blocks in the function that are in this graph.  */
   for (ix = 0; blocks.iterate (ix, &block); ix++)


Grüße
 Thomas



More information about the Gcc-patches mailing list