cfganal.c (pre_and_rev_post_order_compute_fn): Use an auto_bb_flag instead of an...
authorRichard Biener <rguenther@suse.de>
Mon, 25 Nov 2019 07:48:48 +0000 (07:48 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 25 Nov 2019 07:48:48 +0000 (07:48 +0000)
2019-11-25  Richard Biener  <rguenther@suse.de>

* 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
gcc/cfganal.c

index f37b9866a8d98ae42f9b5b0d75c160f847ce3178..a385d20617d39fae33dd32c9dabb12f38b838f15 100644 (file)
@@ -1,3 +1,8 @@
+2019-11-25  Richard Biener  <rguenther@suse.de>
+
+       * 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  <linkw@gcc.gnu.org>
 
        * config/rs6000/vector.md (vector_fp_comparison_simple): New code
index 039769d3a9726aa507bcf51637466d2da6b5d57b..1a5c720984e1c1da28f55d1ba191f188a8d21fc4 100644 (file)
@@ -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;
 }