https://gcc.gnu.org/g:cb4e2685a3e73474246adda356595f72fcd43827
commit r15-280-gcb4e2685a3e73474246adda356595f72fcd43827 Author: Richard Biener <rguent...@suse.de> Date: Wed Apr 17 13:20:40 2024 +0200 Avoid re-allocating vector The following avoids re-allocating the var map BB vector by pre-allocating it to the exact size needed when operating on the whole function. * tree-ssa-live.cc (init_var_map): Pre-allocate vec_bbs vector to the correct size and use quick_push. Diff: --- gcc/tree-ssa-live.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/tree-ssa-live.cc b/gcc/tree-ssa-live.cc index fa6be2fced3..e6ae551a457 100644 --- a/gcc/tree-ssa-live.cc +++ b/gcc/tree-ssa-live.cc @@ -113,8 +113,10 @@ init_var_map (int size, class loop *loop, bitmap bitint) map->outofssa_p = bitint == NULL; map->bitint = bitint; basic_block bb; + map->vec_bbs.reserve_exact (n_basic_blocks_for_fn (cfun) + - NUM_FIXED_BLOCKS); FOR_EACH_BB_FN (bb, cfun) - map->vec_bbs.safe_push (bb); + map->vec_bbs.quick_push (bb); } return map; }