This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Remove verify_no_unreachable_blocks

This removes verify_no_unreachable_blocks and implements checking
for unreachable blocks in inverted_post_order_compute by simply
looking if we reach a block without predecessors that is not the
entry block.

This solves a problem I ran into when (ab-)using BB_REACHABLE
in a pass and I got comparison failues because of -fchecking vs.
-fno-checking.  It also should speed up checking builds.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

Tom, does this make sense?


2018-08-23  Richard Biener  <>

	* cfganal.h (verify_no_unreachable_blocks): Remove.
	* cfganal.c (verify_no_unreachable_blocks): Likewise.
	(inverted_post_order_compute): Do not call verify_no_unreachable_blocks
	instead assert when we reach a block without predecessor that is not
	the entry block.

diff --git a/gcc/cfganal.c b/gcc/cfganal.c
index 3b80758e8f2..baf9f0562f9 100644
--- a/gcc/cfganal.c
+++ b/gcc/cfganal.c
@@ -186,18 +186,6 @@ find_unreachable_blocks (void)
   free (worklist);
-/* Verify that there are no unreachable blocks in the current function.  */
-verify_no_unreachable_blocks (void)
-  find_unreachable_blocks ();
-  basic_block bb;
-  FOR_EACH_BB_FN (bb, cfun)
-    gcc_assert ((bb->flags & BB_REACHABLE) != 0);
 /* Functions to access an edge list with a vector representation.
    Enough data is kept such that given an index number, the
@@ -800,9 +788,6 @@ inverted_post_order_compute (vec<int> *post_order,
   basic_block bb;
   post_order->reserve_exact (n_basic_blocks_for_fn (cfun));
-  if (flag_checking)
-    verify_no_unreachable_blocks ();
   /* Allocate stack for back-tracking up CFG.  */
   auto_vec<edge_iterator, 20> stack (n_basic_blocks_for_fn (cfun) + 1);
@@ -866,7 +851,10 @@ inverted_post_order_compute (vec<int> *post_order,
                    time, check its predecessors.  */
 		stack.quick_push (ei_start (pred->preds));
-		post_order->quick_push (pred->index);
+		{
+		  gcc_assert (pred->index == ENTRY_BLOCK);
+		  post_order->quick_push (pred->index);
+		}
diff --git a/gcc/cfganal.h b/gcc/cfganal.h
index 122c665f7f6..ac3fe8f4617 100644
--- a/gcc/cfganal.h
+++ b/gcc/cfganal.h
@@ -50,7 +50,6 @@ private:
 extern bool mark_dfs_back_edges (void);
 extern void find_unreachable_blocks (void);
-extern void verify_no_unreachable_blocks (void);
 struct edge_list * create_edge_list (void);
 void free_edge_list (struct edge_list *);
 void print_edge_list (FILE *, struct edge_list *);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]