Commit d21d51d0 by Diego Novillo Committed by Diego Novillo

tree-into-ssa.c (insert_phi_nodes_for): Pass argument WORK_STACK by reference.


	* tree-into-ssa.c (insert_phi_nodes_for): Pass argument
	WORK_STACK by reference.
	Call VEC_safe_push instead of VEC_quick_push.
	Update all users.

testsuite/ChangeLog

	* gcc.c-torture/compile/pr18712.c: New test.

From-SVN: r91481
parent 86f029aa
2004-11-29 Diego Novillo <dnovillo@redhat.com>
* tree-into-ssa.c (insert_phi_nodes_for): Pass argument
WORK_STACK by reference.
Call VEC_safe_push instead of VEC_quick_push.
Update all users.
2004-11-29 Daniel Jacobowitz <dan@codesourcery.com> 2004-11-29 Daniel Jacobowitz <dan@codesourcery.com>
PR c/7544 PR c/7544
......
2004-11-29 Diego Novillo <dnovillo@redhat.com>
* gcc.c-torture/compile/pr18712.c: New test.
2004-11-29 Joseph Myers <joseph@codesourcery.com> 2004-11-29 Joseph Myers <joseph@codesourcery.com>
PR c/7544 PR c/7544
......
void *eintr_source (void *arg)
{
int ts = 0;
if (arg)
foo ();
while (1)
{
if (arg)
foo ();
foo1 (&ts);
}
return 0;
}
...@@ -156,7 +156,7 @@ static void insert_phi_nodes (bitmap *, bitmap); ...@@ -156,7 +156,7 @@ static void insert_phi_nodes (bitmap *, bitmap);
static void rewrite_stmt (struct dom_walk_data *, basic_block, static void rewrite_stmt (struct dom_walk_data *, basic_block,
block_stmt_iterator); block_stmt_iterator);
static inline void rewrite_operand (use_operand_p); static inline void rewrite_operand (use_operand_p);
static void insert_phi_nodes_for (tree, bitmap *, VEC(basic_block) *); static void insert_phi_nodes_for (tree, bitmap *, VEC(basic_block) **);
static tree get_reaching_def (tree); static tree get_reaching_def (tree);
static hashval_t def_blocks_hash (const void *); static hashval_t def_blocks_hash (const void *);
static int def_blocks_eq (const void *, const void *); static int def_blocks_eq (const void *, const void *);
...@@ -588,8 +588,8 @@ prepare_def_operand_for_rename (tree def, size_t *uid_p) ...@@ -588,8 +588,8 @@ prepare_def_operand_for_rename (tree def, size_t *uid_p)
WORK_STACK is the vector used to implement the worklist of basic WORK_STACK is the vector used to implement the worklist of basic
blocks. */ blocks. */
static inline static inline void
void insert_phi_nodes_1 (tree var, bitmap *dfs, VEC(basic_block) *work_stack) insert_phi_nodes_1 (tree var, bitmap *dfs, VEC(basic_block) **work_stack)
{ {
if (get_phi_state (var) != NEED_PHI_STATE_NO) if (get_phi_state (var) != NEED_PHI_STATE_NO)
insert_phi_nodes_for (var, dfs, work_stack); insert_phi_nodes_for (var, dfs, work_stack);
...@@ -614,7 +614,7 @@ insert_phi_nodes (bitmap *dfs, bitmap names_to_rename) ...@@ -614,7 +614,7 @@ insert_phi_nodes (bitmap *dfs, bitmap names_to_rename)
/* Vector WORK_STACK is a stack of CFG blocks. Each block that contains /* Vector WORK_STACK is a stack of CFG blocks. Each block that contains
an assignment or PHI node will be pushed to this stack. */ an assignment or PHI node will be pushed to this stack. */
work_stack = VEC_alloc (basic_block, last_basic_block); work_stack = VEC_alloc (basic_block, n_basic_blocks);
/* Iterate over all variables in VARS_TO_RENAME. For each variable, add /* Iterate over all variables in VARS_TO_RENAME. For each variable, add
to the work list all the blocks that have a definition for the to the work list all the blocks that have a definition for the
...@@ -625,17 +625,17 @@ insert_phi_nodes (bitmap *dfs, bitmap names_to_rename) ...@@ -625,17 +625,17 @@ insert_phi_nodes (bitmap *dfs, bitmap names_to_rename)
EXECUTE_IF_SET_IN_BITMAP (names_to_rename, 0, i, bi) EXECUTE_IF_SET_IN_BITMAP (names_to_rename, 0, i, bi)
{ {
if (ssa_name (i)) if (ssa_name (i))
insert_phi_nodes_1 (ssa_name (i), dfs, work_stack); insert_phi_nodes_1 (ssa_name (i), dfs, &work_stack);
} }
} }
else if (vars_to_rename) else if (vars_to_rename)
EXECUTE_IF_SET_IN_BITMAP (vars_to_rename, 0, i, bi) EXECUTE_IF_SET_IN_BITMAP (vars_to_rename, 0, i, bi)
{ {
insert_phi_nodes_1 (referenced_var (i), dfs, work_stack); insert_phi_nodes_1 (referenced_var (i), dfs, &work_stack);
} }
else else
for (i = 0; i < num_referenced_vars; i++) for (i = 0; i < num_referenced_vars; i++)
insert_phi_nodes_1 (referenced_var (i), dfs, work_stack); insert_phi_nodes_1 (referenced_var (i), dfs, &work_stack);
VEC_free (basic_block, work_stack); VEC_free (basic_block, work_stack);
...@@ -999,7 +999,7 @@ htab_statistics (FILE *file, htab_t htab) ...@@ -999,7 +999,7 @@ htab_statistics (FILE *file, htab_t htab)
implement the worklist of basic blocks. */ implement the worklist of basic blocks. */
static void static void
insert_phi_nodes_for (tree var, bitmap *dfs, VEC(basic_block) *work_stack) insert_phi_nodes_for (tree var, bitmap *dfs, VEC(basic_block) **work_stack)
{ {
struct def_blocks_d *def_map; struct def_blocks_d *def_map;
bitmap phi_insertion_points; bitmap phi_insertion_points;
...@@ -1017,7 +1017,7 @@ insert_phi_nodes_for (tree var, bitmap *dfs, VEC(basic_block) *work_stack) ...@@ -1017,7 +1017,7 @@ insert_phi_nodes_for (tree var, bitmap *dfs, VEC(basic_block) *work_stack)
EXECUTE_IF_SET_IN_BITMAP (def_map->def_blocks, 0, bb_index, bi) EXECUTE_IF_SET_IN_BITMAP (def_map->def_blocks, 0, bb_index, bi)
{ {
VEC_quick_push (basic_block, work_stack, BASIC_BLOCK (bb_index)); VEC_safe_push (basic_block, *work_stack, BASIC_BLOCK (bb_index));
} }
/* Pop a block off the worklist, add every block that appears in /* Pop a block off the worklist, add every block that appears in
...@@ -1032,12 +1032,12 @@ insert_phi_nodes_for (tree var, bitmap *dfs, VEC(basic_block) *work_stack) ...@@ -1032,12 +1032,12 @@ insert_phi_nodes_for (tree var, bitmap *dfs, VEC(basic_block) *work_stack)
determine if fully pruned or semi pruned SSA form was appropriate. determine if fully pruned or semi pruned SSA form was appropriate.
We now always use fully pruned SSA form. */ We now always use fully pruned SSA form. */
while (VEC_length (basic_block, work_stack) > 0) while (VEC_length (basic_block, *work_stack) > 0)
{ {
unsigned dfs_index; unsigned dfs_index;
bitmap_iterator bi; bitmap_iterator bi;
bb = VEC_pop (basic_block, work_stack); bb = VEC_pop (basic_block, *work_stack);
bb_index = bb->index; bb_index = bb->index;
EXECUTE_IF_AND_COMPL_IN_BITMAP (dfs[bb_index], EXECUTE_IF_AND_COMPL_IN_BITMAP (dfs[bb_index],
...@@ -1046,7 +1046,10 @@ insert_phi_nodes_for (tree var, bitmap *dfs, VEC(basic_block) *work_stack) ...@@ -1046,7 +1046,10 @@ insert_phi_nodes_for (tree var, bitmap *dfs, VEC(basic_block) *work_stack)
{ {
basic_block bb = BASIC_BLOCK (dfs_index); basic_block bb = BASIC_BLOCK (dfs_index);
VEC_quick_push (basic_block, work_stack, bb); /* Use a safe push because if there is a definition of VAR
in every basic block, then WORK_STACK may eventually have
more than N_BASIC_BLOCK entries. */
VEC_safe_push (basic_block, *work_stack, bb);
bitmap_set_bit (phi_insertion_points, dfs_index); bitmap_set_bit (phi_insertion_points, dfs_index);
} }
} }
......
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