From 5a34952edb758109a3b919bc149136ee9277ee3a Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 25 Nov 2019 07:48:48 +0000 Subject: [PATCH] cfganal.c (pre_and_rev_post_order_compute_fn): Use an auto_bb_flag instead of an sbitmap for visited handling. 2019-11-25 Richard Biener * cfganal.c (pre_and_rev_post_order_compute_fn): Use an auto_bb_flag instead of an sbitmap for visited handling. From-SVN: r278666 --- gcc/ChangeLog | 5 +++++ gcc/cfganal.c | 15 ++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f37b9866a8d..a385d20617d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-11-25 Richard Biener + + * cfganal.c (pre_and_rev_post_order_compute_fn): Use an + auto_bb_flag instead of an sbitmap for visited handling. + 2019-11-25 Kewen Lin * config/rs6000/vector.md (vector_fp_comparison_simple): New code diff --git a/gcc/cfganal.c b/gcc/cfganal.c index 039769d3a97..1a5c720984e 100644 --- a/gcc/cfganal.c +++ b/gcc/cfganal.c @@ -967,11 +967,8 @@ pre_and_rev_post_order_compute_fn (struct function *fn, else rev_post_order_num -= NUM_FIXED_BLOCKS; - /* Allocate bitmap to track nodes that have been visited. */ - auto_sbitmap visited (last_basic_block_for_fn (fn)); - - /* None of the nodes in the CFG have been visited yet. */ - bitmap_clear (visited); + /* BB flag to track nodes that have been visited. */ + auto_bb_flag visited (fn); /* Push the first edge on to the stack. */ stack.quick_push (ei_start (ENTRY_BLOCK_PTR_FOR_FN (fn)->succs)); @@ -988,10 +985,10 @@ pre_and_rev_post_order_compute_fn (struct function *fn, /* Check if the edge destination has been visited yet. */ if (dest != EXIT_BLOCK_PTR_FOR_FN (fn) - && ! bitmap_bit_p (visited, dest->index)) + && ! (dest->flags & visited)) { /* Mark that we have visited the destination. */ - bitmap_set_bit (visited, dest->index); + dest->flags |= visited; if (pre_order) pre_order[pre_order_num] = dest->index; @@ -1032,6 +1029,10 @@ pre_and_rev_post_order_compute_fn (struct function *fn, rev_post_order[rev_post_order_num--] = ENTRY_BLOCK; } + /* Clear the temporarily allocated flag. */ + for (int i = 0; i < pre_order_num; ++i) + BASIC_BLOCK_FOR_FN (fn, rev_post_order[i])->flags &= ~visited; + return pre_order_num; } -- 2.30.2