vec: use inexact growth where possible.
gcc/ChangeLog: * cfgrtl.c (rtl_create_basic_block): Use default value for growth vector function. * gimple.c (gimple_set_bb): Likewise. * symbol-summary.h: Likewise. * tree-cfg.c (init_empty_tree_cfg_for_function): Likewise. (build_gimple_cfg): Likewise. (create_bb): Likewise. (move_block_to_fn): Likewise.
This commit is contained in:
parent
8aa04a189b
commit
a292e31dac
4 changed files with 13 additions and 40 deletions
|
@ -376,12 +376,8 @@ rtl_create_basic_block (void *headp, void *endp, basic_block after)
|
|||
/* Grow the basic block array if needed. */
|
||||
if ((size_t) last_basic_block_for_fn (cfun)
|
||||
>= basic_block_info_for_fn (cfun)->length ())
|
||||
{
|
||||
size_t new_size =
|
||||
(last_basic_block_for_fn (cfun)
|
||||
+ (last_basic_block_for_fn (cfun) + 3) / 4);
|
||||
vec_safe_grow_cleared (basic_block_info_for_fn (cfun), new_size, true);
|
||||
}
|
||||
vec_safe_grow_cleared (basic_block_info_for_fn (cfun),
|
||||
last_basic_block_for_fn (cfun) + 1);
|
||||
|
||||
n_basic_blocks_for_fn (cfun)++;
|
||||
|
||||
|
|
|
@ -1689,12 +1689,7 @@ gimple_set_bb (gimple *stmt, basic_block bb)
|
|||
vec_safe_length (label_to_block_map_for_fn (cfun));
|
||||
LABEL_DECL_UID (t) = uid = cfun->cfg->last_label_uid++;
|
||||
if (old_len <= (unsigned) uid)
|
||||
{
|
||||
unsigned new_len = 3 * uid / 2 + 1;
|
||||
|
||||
vec_safe_grow_cleared (label_to_block_map_for_fn (cfun),
|
||||
new_len, true);
|
||||
}
|
||||
vec_safe_grow_cleared (label_to_block_map_for_fn (cfun), uid + 1);
|
||||
}
|
||||
|
||||
(*label_to_block_map_for_fn (cfun))[uid] = bb;
|
||||
|
|
|
@ -354,11 +354,8 @@ public:
|
|||
id = this->m_symtab->assign_summary_id (node);
|
||||
|
||||
if ((unsigned int)id >= m_vector->length ())
|
||||
{
|
||||
int newlen = this->m_symtab->cgraph_max_summary_id;
|
||||
vec_safe_reserve (m_vector, newlen - m_vector->length ());
|
||||
m_vector->quick_grow_cleared (newlen);
|
||||
}
|
||||
vec_safe_grow_cleared (m_vector,
|
||||
this->m_symtab->cgraph_max_summary_id);
|
||||
|
||||
if ((*m_vector)[id] == NULL)
|
||||
(*m_vector)[id] = this->allocate_new ();
|
||||
|
@ -815,11 +812,7 @@ public:
|
|||
id = this->m_symtab->assign_summary_id (edge);
|
||||
|
||||
if ((unsigned)id >= m_vector->length ())
|
||||
{
|
||||
int newlen = this->m_symtab->edges_max_summary_id;
|
||||
m_vector->reserve (newlen - m_vector->length ());
|
||||
m_vector->quick_grow_cleared (newlen);
|
||||
}
|
||||
vec_safe_grow_cleared (m_vector, this->m_symtab->edges_max_summary_id);
|
||||
|
||||
if ((*m_vector)[id] == NULL)
|
||||
(*m_vector)[id] = this->allocate_new ();
|
||||
|
|
|
@ -181,12 +181,10 @@ init_empty_tree_cfg_for_function (struct function *fn)
|
|||
profile_status_for_fn (fn) = PROFILE_ABSENT;
|
||||
n_basic_blocks_for_fn (fn) = NUM_FIXED_BLOCKS;
|
||||
last_basic_block_for_fn (fn) = NUM_FIXED_BLOCKS;
|
||||
vec_alloc (basic_block_info_for_fn (fn), initial_cfg_capacity);
|
||||
vec_safe_grow_cleared (basic_block_info_for_fn (fn),
|
||||
initial_cfg_capacity, true);
|
||||
|
||||
/* Build a mapping of labels to their associated blocks. */
|
||||
vec_alloc (label_to_block_map_for_fn (fn), initial_cfg_capacity);
|
||||
vec_safe_grow_cleared (label_to_block_map_for_fn (fn),
|
||||
initial_cfg_capacity, true);
|
||||
|
||||
|
@ -232,7 +230,7 @@ build_gimple_cfg (gimple_seq seq)
|
|||
if (basic_block_info_for_fn (cfun)->length ()
|
||||
< (size_t) n_basic_blocks_for_fn (cfun))
|
||||
vec_safe_grow_cleared (basic_block_info_for_fn (cfun),
|
||||
n_basic_blocks_for_fn (cfun), true);
|
||||
n_basic_blocks_for_fn (cfun));
|
||||
|
||||
/* To speed up statement iterator walks, we first purge dead labels. */
|
||||
cleanup_dead_labels ();
|
||||
|
@ -681,12 +679,8 @@ create_bb (void *h, void *e, basic_block after)
|
|||
/* Grow the basic block array if needed. */
|
||||
if ((size_t) last_basic_block_for_fn (cfun)
|
||||
== basic_block_info_for_fn (cfun)->length ())
|
||||
{
|
||||
size_t new_size =
|
||||
(last_basic_block_for_fn (cfun)
|
||||
+ (last_basic_block_for_fn (cfun) + 3) / 4);
|
||||
vec_safe_grow_cleared (basic_block_info_for_fn (cfun), new_size, true);
|
||||
}
|
||||
vec_safe_grow_cleared (basic_block_info_for_fn (cfun),
|
||||
last_basic_block_for_fn (cfun) + 1);
|
||||
|
||||
/* Add the newly created block to the array. */
|
||||
SET_BASIC_BLOCK_FOR_FN (cfun, last_basic_block_for_fn (cfun), bb);
|
||||
|
@ -7094,7 +7088,7 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
|
|||
edge_iterator ei;
|
||||
edge e;
|
||||
gimple_stmt_iterator si;
|
||||
unsigned old_len, new_len;
|
||||
unsigned old_len;
|
||||
|
||||
/* Remove BB from dominance structures. */
|
||||
delete_from_dominance_info (CDI_DOMINATORS, bb);
|
||||
|
@ -7130,10 +7124,8 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
|
|||
|
||||
old_len = vec_safe_length (cfg->x_basic_block_info);
|
||||
if ((unsigned) cfg->x_last_basic_block >= old_len)
|
||||
{
|
||||
new_len = cfg->x_last_basic_block + (cfg->x_last_basic_block + 3) / 4;
|
||||
vec_safe_grow_cleared (cfg->x_basic_block_info, new_len, true);
|
||||
}
|
||||
vec_safe_grow_cleared (cfg->x_basic_block_info,
|
||||
cfg->x_last_basic_block + 1);
|
||||
|
||||
(*cfg->x_basic_block_info)[bb->index] = bb;
|
||||
|
||||
|
@ -7206,10 +7198,7 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
|
|||
|
||||
old_len = vec_safe_length (cfg->x_label_to_block_map);
|
||||
if (old_len <= (unsigned) uid)
|
||||
{
|
||||
new_len = 3 * uid / 2 + 1;
|
||||
vec_safe_grow_cleared (cfg->x_label_to_block_map, new_len, true);
|
||||
}
|
||||
vec_safe_grow_cleared (cfg->x_label_to_block_map, uid + 1);
|
||||
|
||||
(*cfg->x_label_to_block_map)[uid] = bb;
|
||||
(*cfun->cfg->x_label_to_block_map)[uid] = NULL;
|
||||
|
|
Loading…
Add table
Reference in a new issue