Commit a352b710 by Tom de Vries Committed by Tom de Vries

Check no unreachable blocks in inverted_post_order_compute

2015-10-14  Tom de Vries  <tom@codesourcery.com>

	* cfganal.c (verify_no_unreachable_blocks): New function.
	(inverted_post_order_compute) [ENABLE_CHECKING]: Call
	verify_no_unreachable_blocks.
	cfganal.h (verify_no_unreachable_blocks): Declare.

From-SVN: r228789
parent 179b8d05
2015-10-14 Tom de Vries <tom@codesourcery.com>
* cfganal.c (verify_no_unreachable_blocks): New function.
(inverted_post_order_compute) [ENABLE_CHECKING]: Call
verify_no_unreachable_blocks.
cfganal.h (verify_no_unreachable_blocks): Declare.
2015-10-13 Mikhail Maltsev <maltsevm@gmail.com> 2015-10-13 Mikhail Maltsev <maltsevm@gmail.com>
* common.opt: Add flag_checking. * common.opt: Add flag_checking.
...@@ -194,6 +194,19 @@ find_unreachable_blocks (void) ...@@ -194,6 +194,19 @@ find_unreachable_blocks (void)
free (worklist); free (worklist);
} }
/* Verify that there are no unreachable blocks in the current function. */
void
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. /* Functions to access an edge list with a vector representation.
Enough data is kept such that given an index number, the Enough data is kept such that given an index number, the
pred and succ that edge represents can be determined, or pred and succ that edge represents can be determined, or
...@@ -772,6 +785,10 @@ inverted_post_order_compute (int *post_order) ...@@ -772,6 +785,10 @@ inverted_post_order_compute (int *post_order)
int post_order_num = 0; int post_order_num = 0;
sbitmap visited; sbitmap visited;
#if ENABLE_CHECKING
verify_no_unreachable_blocks ();
#endif
/* Allocate stack for back-tracking up CFG. */ /* Allocate stack for back-tracking up CFG. */
stack = XNEWVEC (edge_iterator, n_basic_blocks_for_fn (cfun) + 1); stack = XNEWVEC (edge_iterator, n_basic_blocks_for_fn (cfun) + 1);
sp = 0; sp = 0;
......
...@@ -49,6 +49,7 @@ private: ...@@ -49,6 +49,7 @@ private:
extern bool mark_dfs_back_edges (void); extern bool mark_dfs_back_edges (void);
extern void find_unreachable_blocks (void); extern void find_unreachable_blocks (void);
extern void verify_no_unreachable_blocks (void);
struct edge_list * create_edge_list (void); struct edge_list * create_edge_list (void);
void free_edge_list (struct edge_list *); void free_edge_list (struct edge_list *);
void print_edge_list (FILE *, struct edge_list *); void print_edge_list (FILE *, struct edge_list *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment