dominance.c (free_dominance_info): Add overload with function parameter.

2014-04-29  Richard Biener  <rguenther@suse.de>

	* dominance.c (free_dominance_info): Add overload with
	function parameter.
	(dom_info_state): Likewise.
	(dom_info_available_p): Likewise.
	* basic-block.h (free_dominance_info, dom_info_state,
	dom_info_available_p): Declare overloads.
	* passes.c (execute_function_todo): Verify that verifiers
	don't change dominator info state.  Drop dominator info
	for IPA pass invocations.
	* cgraph.c (release_function_body): Restore asserts that
	dominator information is released.

From-SVN: r209892
This commit is contained in:
Richard Biener 2014-04-29 11:37:55 +00:00 committed by Richard Biener
parent 36f291f765
commit e3f613cbbc
5 changed files with 86 additions and 39 deletions

View File

@ -1,3 +1,17 @@
2014-04-29 Richard Biener <rguenther@suse.de>
* dominance.c (free_dominance_info): Add overload with
function parameter.
(dom_info_state): Likewise.
(dom_info_available_p): Likewise.
* basic-block.h (free_dominance_info, dom_info_state,
dom_info_available_p): Declare overloads.
* passes.c (execute_function_todo): Verify that verifiers
don't change dominator info state. Drop dominator info
for IPA pass invocations.
* cgraph.c (release_function_body): Restore asserts that
dominator information is released.
2014-04-29 Patrick Palka <patrick@parcs.ath.cx>
* doc/invoke.texi: Fix typo.

View File

@ -826,10 +826,13 @@ enum cdi_direction
CDI_POST_DOMINATORS = 2
};
extern enum dom_state dom_info_state (function *, enum cdi_direction);
extern enum dom_state dom_info_state (enum cdi_direction);
extern void set_dom_info_availability (enum cdi_direction, enum dom_state);
extern bool dom_info_available_p (function *, enum cdi_direction);
extern bool dom_info_available_p (enum cdi_direction);
extern void calculate_dominance_info (enum cdi_direction);
extern void free_dominance_info (function *, enum cdi_direction);
extern void free_dominance_info (enum cdi_direction);
extern basic_block nearest_common_dominator (enum cdi_direction,
basic_block, basic_block);

View File

@ -1696,8 +1696,8 @@ release_function_body (tree decl)
}
if (cfun->cfg)
{
free_dominance_info (CDI_DOMINATORS);
free_dominance_info (CDI_POST_DOMINATORS);
gcc_assert (!dom_info_available_p (CDI_DOMINATORS));
gcc_assert (!dom_info_available_p (CDI_POST_DOMINATORS));
clear_edges ();
cfun->cfg = NULL;
}

View File

@ -681,24 +681,30 @@ calculate_dominance_info (enum cdi_direction dir)
/* Free dominance information for direction DIR. */
void
free_dominance_info (enum cdi_direction dir)
free_dominance_info (function *fn, enum cdi_direction dir)
{
basic_block bb;
unsigned int dir_index = dom_convert_dir_to_idx (dir);
if (!dom_info_available_p (dir))
if (!dom_info_available_p (fn, dir))
return;
FOR_ALL_BB_FN (bb, cfun)
FOR_ALL_BB_FN (bb, fn)
{
et_free_tree_force (bb->dom[dir_index]);
bb->dom[dir_index] = NULL;
}
et_free_pools ();
n_bbs_in_dom_tree[dir_index] = 0;
fn->cfg->x_n_bbs_in_dom_tree[dir_index] = 0;
dom_computed[dir_index] = DOM_NONE;
fn->cfg->x_dom_computed[dir_index] = DOM_NONE;
}
void
free_dominance_info (enum cdi_direction dir)
{
free_dominance_info (cfun, dir);
}
/* Return the immediate dominator of basic block BB. */
@ -1460,12 +1466,20 @@ next_dom_son (enum cdi_direction dir, basic_block bb)
/* Return dominance availability for dominance info DIR. */
enum dom_state
dom_info_state (function *fn, enum cdi_direction dir)
{
if (!fn->cfg)
return DOM_NONE;
unsigned int dir_index = dom_convert_dir_to_idx (dir);
return fn->cfg->x_dom_computed[dir_index];
}
enum dom_state
dom_info_state (enum cdi_direction dir)
{
unsigned int dir_index = dom_convert_dir_to_idx (dir);
return dom_computed[dir_index];
return dom_info_state (cfun, dir);
}
/* Set the dominance availability for dominance info DIR to NEW_STATE. */
@ -1480,12 +1494,16 @@ set_dom_info_availability (enum cdi_direction dir, enum dom_state new_state)
/* Returns true if dominance information for direction DIR is available. */
bool
dom_info_available_p (function *fn, enum cdi_direction dir)
{
return dom_info_state (fn, dir) != DOM_NONE;
}
bool
dom_info_available_p (enum cdi_direction dir)
{
unsigned int dir_index = dom_convert_dir_to_idx (dir);
return dom_computed[dir_index] != DOM_NONE;
return dom_info_available_p (cfun, dir);
}
DEBUG_FUNCTION void

View File

@ -1761,41 +1761,53 @@ execute_function_todo (function *fn, void *data)
rebuild_cgraph_edges ();
/* If we've seen errors do not bother running any verifiers. */
if (seen_error ())
if (!seen_error ())
{
pop_cfun ();
return;
}
#if defined ENABLE_CHECKING
if (flags & TODO_verify_ssa)
{
verify_gimple_in_cfg (cfun);
verify_ssa (true);
}
else if (flags & TODO_verify_stmts)
verify_gimple_in_cfg (cfun);
if (flags & TODO_verify_flow)
verify_flow_info ();
if (flags & TODO_verify_il)
{
if (current_loops
&& loops_state_satisfies_p (LOOP_CLOSED_SSA))
dom_state pre_verify_state = dom_info_state (fn, CDI_DOMINATORS);
dom_state pre_verify_pstate = dom_info_state (fn, CDI_POST_DOMINATORS);
if (flags & TODO_verify_ssa)
{
if (!(flags & (TODO_verify_stmts|TODO_verify_ssa)))
verify_gimple_in_cfg (cfun);
if (!(flags & TODO_verify_ssa))
verify_ssa (true);
verify_loop_closed_ssa (false);
verify_gimple_in_cfg (cfun);
verify_ssa (true);
}
}
if (flags & TODO_verify_rtl_sharing)
verify_rtl_sharing ();
else if (flags & TODO_verify_stmts)
verify_gimple_in_cfg (cfun);
if (flags & TODO_verify_flow)
verify_flow_info ();
if (flags & TODO_verify_il)
{
if (current_loops
&& loops_state_satisfies_p (LOOP_CLOSED_SSA))
{
if (!(flags & (TODO_verify_stmts|TODO_verify_ssa)))
verify_gimple_in_cfg (cfun);
if (!(flags & TODO_verify_ssa))
verify_ssa (true);
verify_loop_closed_ssa (false);
}
}
if (flags & TODO_verify_rtl_sharing)
verify_rtl_sharing ();
/* Make sure verifiers don't change dominator state. */
gcc_assert (dom_info_state (fn, CDI_DOMINATORS) == pre_verify_state);
gcc_assert (dom_info_state (fn, CDI_POST_DOMINATORS) == pre_verify_pstate);
#endif
}
fn->last_verified = flags & TODO_verify_all;
pop_cfun ();
/* For IPA passes make sure to release dominator info, it can be
computed by non-verifying TODOs. */
if (!cfun)
{
free_dominance_info (fn, CDI_DOMINATORS);
free_dominance_info (fn, CDI_POST_DOMINATORS);
}
}
/* Perform all TODO actions. */