]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
use auto_bitmap more
authorTrevor Saunders <tbsaunde+gcc@tbsaunde.org>
Sun, 14 May 2017 00:38:48 +0000 (00:38 +0000)
committerTrevor Saunders <tbsaunde@gcc.gnu.org>
Sun, 14 May 2017 00:38:48 +0000 (00:38 +0000)
gcc/ChangeLog:

2017-05-13  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

* bt-load.c (combine_btr_defs): Use auto_bitmap to manage bitmap
lifetime.
(migrate_btr_def): Likewise.
* cfgloop.c (get_loop_body_in_bfs_order): Likewise.
* df-core.c (loop_post_order_compute): Likewise.
(loop_inverted_post_order_compute): Likewise.
* hsa-common.h: Likewise.
* hsa-gen.c (hsa_bb::~hsa_bb): Likewise.
* init-regs.c (initialize_uninitialized_regs): Likewise.
* ipa-inline.c (resolve_noninline_speculation): Likewise.
(inline_small_functions): Likewise.
* ipa-reference.c (ipa_reference_write_optimization_summary): Likewise.
* ira.c (combine_and_move_insns): Likewise.
(build_insn_chain): Likewise.
* loop-invariant.c (find_invariants): Likewise.
* lower-subreg.c (propagate_pseudo_copies): Likewise.
* predict.c (tree_predict_by_opcode): Likewise.
(predict_paths_leading_to): Likewise.
(predict_paths_leading_to_edge): Likewise.
(estimate_loops_at_level): Likewise.
(estimate_loops): Likewise.
* shrink-wrap.c (try_shrink_wrapping): Likewise.
(spread_components): Likewise.
* tree-cfg.c (remove_edge_and_dominated_blocks): Likewise.
* tree-loop-distribution.c (rdg_build_partitions): Likewise.
* tree-predcom.c (tree_predictive_commoning_loop): Likewise.
* tree-ssa-coalesce.c (coalesce_ssa_name): Likewise.
* tree-ssa-phionlycprop.c (pass_phi_only_cprop::execute): Likewise.
* tree-ssa-pre.c (remove_dead_inserted_code): Likewise.
* tree-ssa-sink.c (nearest_common_dominator_of_uses): Likewise.
* tree-ssa-threadupdate.c (compute_path_counts): Likewise.
(mark_threaded_blocks): Likewise.
(thread_through_all_blocks): Likewise.
* tree-ssa.c (verify_ssa): Likewise.
(execute_update_addresses_taken): Likewise.
* tree-ssanames.c (verify_ssaname_freelists): Likewise.

From-SVN: r248021

24 files changed:
gcc/ChangeLog
gcc/bt-load.c
gcc/cfgloop.c
gcc/df-core.c
gcc/hsa-common.h
gcc/hsa-gen.c
gcc/init-regs.c
gcc/ipa-inline.c
gcc/ipa-reference.c
gcc/ira.c
gcc/loop-invariant.c
gcc/lower-subreg.c
gcc/predict.c
gcc/shrink-wrap.c
gcc/tree-cfg.c
gcc/tree-loop-distribution.c
gcc/tree-predcom.c
gcc/tree-ssa-coalesce.c
gcc/tree-ssa-phionlycprop.c
gcc/tree-ssa-pre.c
gcc/tree-ssa-sink.c
gcc/tree-ssa-threadupdate.c
gcc/tree-ssa.c
gcc/tree-ssanames.c

index c0d3cf8b601af4f72b77c2e990b3e349d00e4962..170e0b34996d1dda2e532f52375ba05b3c268b07 100644 (file)
@@ -1,3 +1,42 @@
+2017-05-13  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
+
+       * bt-load.c (combine_btr_defs): Use auto_bitmap to manage bitmap
+       lifetime.
+       (migrate_btr_def): Likewise.
+       * cfgloop.c (get_loop_body_in_bfs_order): Likewise.
+       * df-core.c (loop_post_order_compute): Likewise.
+       (loop_inverted_post_order_compute): Likewise.
+       * hsa-common.h: Likewise.
+       * hsa-gen.c (hsa_bb::~hsa_bb): Likewise.
+       * init-regs.c (initialize_uninitialized_regs): Likewise.
+       * ipa-inline.c (resolve_noninline_speculation): Likewise.
+       (inline_small_functions): Likewise.
+       * ipa-reference.c (ipa_reference_write_optimization_summary): Likewise.
+       * ira.c (combine_and_move_insns): Likewise.
+       (build_insn_chain): Likewise.
+       * loop-invariant.c (find_invariants): Likewise.
+       * lower-subreg.c (propagate_pseudo_copies): Likewise.
+       * predict.c (tree_predict_by_opcode): Likewise.
+       (predict_paths_leading_to): Likewise.
+       (predict_paths_leading_to_edge): Likewise.
+       (estimate_loops_at_level): Likewise.
+       (estimate_loops): Likewise.
+       * shrink-wrap.c (try_shrink_wrapping): Likewise.
+       (spread_components): Likewise.
+       * tree-cfg.c (remove_edge_and_dominated_blocks): Likewise.
+       * tree-loop-distribution.c (rdg_build_partitions): Likewise.
+       * tree-predcom.c (tree_predictive_commoning_loop): Likewise.
+       * tree-ssa-coalesce.c (coalesce_ssa_name): Likewise.
+       * tree-ssa-phionlycprop.c (pass_phi_only_cprop::execute): Likewise.
+       * tree-ssa-pre.c (remove_dead_inserted_code): Likewise.
+       * tree-ssa-sink.c (nearest_common_dominator_of_uses): Likewise.
+       * tree-ssa-threadupdate.c (compute_path_counts): Likewise.
+       (mark_threaded_blocks): Likewise.
+       (thread_through_all_blocks): Likewise.
+       * tree-ssa.c (verify_ssa): Likewise.
+       (execute_update_addresses_taken): Likewise.
+       * tree-ssanames.c (verify_ssaname_freelists): Likewise.
+
 2017-05-13  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
 
        * cfganal.c (mark_dfs_back_edges): Replace manual stack with
index 27be6a382c47846e8fd2706da00fde4dff06ca99..32924e2ecc5d5fc3008ffeeabbc85d9512e6505e 100644 (file)
@@ -1058,7 +1058,7 @@ combine_btr_defs (btr_def *def, HARD_REG_SET *btrs_live_in_range)
             target registers live over the merged range.  */
          int btr;
          HARD_REG_SET combined_btrs_live;
-         bitmap combined_live_range = BITMAP_ALLOC (NULL);
+         auto_bitmap combined_live_range;
          btr_user *user;
 
          if (other_def->live_range == NULL)
@@ -1116,7 +1116,6 @@ combine_btr_defs (btr_def *def, HARD_REG_SET *btrs_live_in_range)
              delete_insn (other_def->insn);
 
            }
-         BITMAP_FREE (combined_live_range);
        }
     }
 }
@@ -1255,7 +1254,6 @@ can_move_up (const_basic_block bb, const rtx_insn *insn, int n_insns)
 static int
 migrate_btr_def (btr_def *def, int min_cost)
 {
-  bitmap live_range;
   HARD_REG_SET btrs_live_in_range;
   int btr_used_near_def = 0;
   int def_basic_block_freq;
@@ -1289,7 +1287,7 @@ migrate_btr_def (btr_def *def, int min_cost)
     }
 
   btr_def_live_range (def, &btrs_live_in_range);
-  live_range = BITMAP_ALLOC (NULL);
+  auto_bitmap live_range;
   bitmap_copy (live_range, def->live_range);
 
 #ifdef INSN_SCHEDULING
@@ -1373,7 +1371,7 @@ migrate_btr_def (btr_def *def, int min_cost)
       if (dump_file)
        fprintf (dump_file, "failed to move\n");
     }
-  BITMAP_FREE (live_range);
+
   return !give_up;
 }
 
index afd56bb8cf7f725f08c07c1ddab28face786f10d..654d188e8b5328af22da3f2337151430765643c2 100644 (file)
@@ -923,7 +923,6 @@ get_loop_body_in_bfs_order (const struct loop *loop)
 {
   basic_block *blocks;
   basic_block bb;
-  bitmap visited;
   unsigned int i = 1;
   unsigned int vc = 0;
 
@@ -931,7 +930,7 @@ get_loop_body_in_bfs_order (const struct loop *loop)
   gcc_assert (loop->latch != EXIT_BLOCK_PTR_FOR_FN (cfun));
 
   blocks = XNEWVEC (basic_block, loop->num_nodes);
-  visited = BITMAP_ALLOC (NULL);
+  auto_bitmap visited;
   blocks[0] = loop->header;
   bitmap_set_bit (visited, loop->header->index);
   while (i < loop->num_nodes)
@@ -952,7 +951,6 @@ get_loop_body_in_bfs_order (const struct loop *loop)
        }
     }
 
-  BITMAP_FREE (visited);
   return blocks;
 }
 
index 19f4d3dae8ccc2be37b3ce79423eae5feccf7313..98787a768c6699202c5fe4d19c5a0a89bb5f8a8a 100644 (file)
@@ -1303,14 +1303,13 @@ loop_post_order_compute (int *post_order, struct loop *loop)
   edge_iterator *stack;
   int sp;
   int post_order_num = 0;
-  bitmap visited;
 
   /* Allocate stack for back-tracking up CFG.  */
   stack = XNEWVEC (edge_iterator, loop->num_nodes + 1);
   sp = 0;
 
   /* Allocate bitmap to track nodes that have been visited.  */
-  visited = BITMAP_ALLOC (NULL);
+  auto_bitmap visited;
 
   /* Push the first edge on to the stack.  */
   stack[sp++] = ei_start (loop_preheader_edge (loop)->src->succs);
@@ -1352,7 +1351,6 @@ loop_post_order_compute (int *post_order, struct loop *loop)
     }
 
   free (stack);
-  BITMAP_FREE (visited);
 
   return post_order_num;
 }
@@ -1367,14 +1365,13 @@ loop_inverted_post_order_compute (int *post_order, struct loop *loop)
   edge_iterator *stack;
   int sp;
   int post_order_num = 0;
-  bitmap visited;
 
   /* Allocate stack for back-tracking up CFG.  */
   stack = XNEWVEC (edge_iterator, loop->num_nodes + 1);
   sp = 0;
 
   /* Allocate bitmap to track nodes that have been visited.  */
-  visited = BITMAP_ALLOC (NULL);
+  auto_bitmap visited;
 
   /* Put all latches into the initial work list.  In theory we'd want
      to start from loop exits but then we'd have the special case of
@@ -1420,7 +1417,6 @@ loop_inverted_post_order_compute (int *post_order, struct loop *loop)
     }
 
   free (stack);
-  BITMAP_FREE (visited);
   return post_order_num;
 }
 
index a24bf6e5ad178b1d8fcbf0cfd6f0e4c394caece9..810624e4e1c9b0fa521eb03c1dd0176f6f08b839 100644 (file)
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "vec.h"
 #include "hash-table.h"
 #include "basic-block.h"
+#include "bitmap.h"
 
 
 /* Return true if the compiler should produce HSAIL.  */
@@ -1027,7 +1028,6 @@ class hsa_bb
 public:
   hsa_bb (basic_block cfg_bb);
   hsa_bb (basic_block cfg_bb, int idx);
-  ~hsa_bb ();
 
   /* Append an instruction INSN into the basic block.  */
   void append_insn (hsa_insn_basic *insn);
@@ -1049,7 +1049,7 @@ public:
   /* Just a number to construct names from.  */
   int m_index;
 
-  bitmap m_liveout, m_livein;
+  auto_bitmap m_liveout, m_livein;
 private:
   /* Make the default constructor inaccessible.  */
   hsa_bb ();
index 4b85e0b267869e5bf0fdd33b23b3e1f3b907a366..c5d8a6e1f445773b9f892da8cbc47e5450baf8c1 100644 (file)
@@ -5716,8 +5716,7 @@ gen_hsa_phi_from_gimple_phi (gimple *phi_stmt, hsa_bb *hbb)
 
 hsa_bb::hsa_bb (basic_block cfg_bb, int idx)
   : m_bb (cfg_bb), m_first_insn (NULL), m_last_insn (NULL), m_first_phi (NULL),
-    m_last_phi (NULL), m_index (idx), m_liveout (BITMAP_ALLOC (NULL)),
-    m_livein (BITMAP_ALLOC (NULL))
+    m_last_phi (NULL), m_index (idx)
 {
   gcc_assert (!cfg_bb->aux);
   cfg_bb->aux = this;
@@ -5728,21 +5727,12 @@ hsa_bb::hsa_bb (basic_block cfg_bb, int idx)
 
 hsa_bb::hsa_bb (basic_block cfg_bb)
   : m_bb (cfg_bb), m_first_insn (NULL), m_last_insn (NULL), m_first_phi (NULL),
-    m_last_phi (NULL), m_index (hsa_cfun->m_hbb_count++),
-    m_liveout (BITMAP_ALLOC (NULL)), m_livein (BITMAP_ALLOC (NULL))
+    m_last_phi (NULL), m_index (hsa_cfun->m_hbb_count++)
 {
   gcc_assert (!cfg_bb->aux);
   cfg_bb->aux = this;
 }
 
-/* Destructor of class representing HSA BB.  */
-
-hsa_bb::~hsa_bb ()
-{
-  BITMAP_FREE (m_livein);
-  BITMAP_FREE (m_liveout);
-}
-
 /* Create and initialize and return a new hsa_bb structure for a given CFG
    basic block BB.  */
 
index 2c69991c9e1b735343e4d67699cfa088bab494cd..15d774671497985cdb1a6e7d78ec1d6ca717df9b 100644 (file)
@@ -48,7 +48,7 @@ static void
 initialize_uninitialized_regs (void)
 {
   basic_block bb;
-  bitmap already_genned = BITMAP_ALLOC (NULL);
+  auto_bitmap already_genned;
 
   if (optimize == 1)
     {
@@ -125,8 +125,6 @@ initialize_uninitialized_regs (void)
        df_dump (dump_file);
       df_remove_problem (df_live);
     }
-
-  BITMAP_FREE (already_genned);
 }
 
 namespace {
index ce79af5719e850129c2ca5d46e72290244b06a92..7337e0a2fe59fde70a75e055bfbc001e71a2dcfc 100644 (file)
@@ -1674,7 +1674,7 @@ resolve_noninline_speculation (edge_heap_t *edge_heap, struct cgraph_edge *edge)
       struct cgraph_node *node = edge->caller;
       struct cgraph_node *where = node->global.inlined_to
                                  ? node->global.inlined_to : node;
-      bitmap updated_nodes = BITMAP_ALLOC (NULL);
+      auto_bitmap updated_nodes;
 
       spec_rem += edge->count;
       edge->resolve_speculation ();
@@ -1684,7 +1684,6 @@ resolve_noninline_speculation (edge_heap_t *edge_heap, struct cgraph_edge *edge)
                          updated_nodes, NULL);
       update_callee_keys (edge_heap, where,
                          updated_nodes);
-      BITMAP_FREE (updated_nodes);
     }
 }
 
@@ -1726,7 +1725,7 @@ inline_small_functions (void)
   struct cgraph_node *node;
   struct cgraph_edge *edge;
   edge_heap_t edge_heap (sreal::min ());
-  bitmap updated_nodes = BITMAP_ALLOC (NULL);
+  auto_bitmap updated_nodes;
   int min_size, max_size;
   auto_vec<cgraph_edge *> new_indirect_edges;
   int initial_size = 0;
@@ -2072,7 +2071,6 @@ inline_small_functions (void)
             "Unit growth for small function inlining: %i->%i (%i%%)\n",
             initial_size, overall_size,
             initial_size ? overall_size * 100 / (initial_size) - 100: 0);
-  BITMAP_FREE (updated_nodes);
   symtab->remove_edge_removal_hook (edge_removal_hook_holder);
 }
 
index f47d0cc51e1d434dfdcb521274f7be11b3d645df..222253920fd5361e546e73eacc1d96dfbd2e33e0 100644 (file)
@@ -992,7 +992,7 @@ ipa_reference_write_optimization_summary (void)
   unsigned int count = 0;
   int ltrans_statics_bitcount = 0;
   lto_symtab_encoder_t encoder = ob->decl_state->symtab_node_encoder;
-  bitmap ltrans_statics = BITMAP_ALLOC (NULL);
+  auto_bitmap ltrans_statics;
   int i;
 
   reference_vars_to_consider = splay_tree_new (splay_tree_compare_ints, 0, 0);
@@ -1052,7 +1052,6 @@ ipa_reference_write_optimization_summary (void)
                               ltrans_statics_bitcount);
          }
       }
-  BITMAP_FREE (ltrans_statics);
   lto_destroy_simple_output_block (ob);
   splay_tree_delete (reference_vars_to_consider);
 }
index bfb05080de1247d2011a4bd6b0f9a0f6eac47c5b..c9751ce81baedaf5ec671e5aa993a7d7995c68cc 100644 (file)
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -3698,7 +3698,7 @@ add_store_equivs (void)
 static void
 combine_and_move_insns (void)
 {
-  bitmap cleared_regs = BITMAP_ALLOC (NULL);
+  auto_bitmap cleared_regs;
   int max = max_reg_num ();
 
   for (int regno = FIRST_PSEUDO_REGISTER; regno < max; regno++)
@@ -3856,8 +3856,6 @@ combine_and_move_insns (void)
                df_insn_rescan (insn);
            }
     }
-
-  BITMAP_FREE (cleared_regs);
 }
 
 /* A pass over indirect jumps, converting simple cases to direct jumps.
@@ -4083,8 +4081,8 @@ build_insn_chain (void)
   basic_block bb;
   struct insn_chain *c = NULL;
   struct insn_chain *next = NULL;
-  bitmap live_relevant_regs = BITMAP_ALLOC (NULL);
-  bitmap elim_regset = BITMAP_ALLOC (NULL);
+  auto_bitmap live_relevant_regs;
+  auto_bitmap elim_regset;
   /* live_subregs is a vector used to keep accurate information about
      which hardregs are live in multiword pseudos.  live_subregs and
      live_subregs_used are indexed by pseudo number.  The live_subreg
@@ -4093,7 +4091,7 @@ build_insn_chain (void)
      live_subreg[allocno] is number of bytes that the pseudo can
      occupy.  */
   sbitmap *live_subregs = XCNEWVEC (sbitmap, max_regno);
-  bitmap live_subregs_used = BITMAP_ALLOC (NULL);
+  auto_bitmap live_subregs_used;
 
   for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
     if (TEST_HARD_REG_BIT (eliminable_regset, i))
@@ -4336,9 +4334,6 @@ build_insn_chain (void)
     if (live_subregs[i] != NULL)
       sbitmap_free (live_subregs[i]);
   free (live_subregs);
-  BITMAP_FREE (live_subregs_used);
-  BITMAP_FREE (live_relevant_regs);
-  BITMAP_FREE (elim_regset);
 
   if (dump_file)
     print_insn_chains (dump_file);
index 8292cea3e521e1bd0f4fe397cb393b2ba062766f..cda42efd13ebfdc4141513d14337931c3f70218d 100644 (file)
@@ -1219,10 +1219,10 @@ find_invariants_body (struct loop *loop, basic_block *body,
 static void
 find_invariants (struct loop *loop)
 {
-  bitmap may_exit = BITMAP_ALLOC (NULL);
-  bitmap always_reached = BITMAP_ALLOC (NULL);
-  bitmap has_exit = BITMAP_ALLOC (NULL);
-  bitmap always_executed = BITMAP_ALLOC (NULL);
+  auto_bitmap may_exit;
+  auto_bitmap always_reached;
+  auto_bitmap has_exit;
+  auto_bitmap always_executed;
   basic_block *body = get_loop_body_in_dom_order (loop);
 
   find_exits (loop, body, may_exit, has_exit);
@@ -1233,10 +1233,6 @@ find_invariants (struct loop *loop)
   find_invariants_body (loop, body, always_reached, always_executed);
   merge_identical_invariants ();
 
-  BITMAP_FREE (always_reached);
-  BITMAP_FREE (always_executed);
-  BITMAP_FREE (may_exit);
-  BITMAP_FREE (has_exit);
   free (body);
 }
 
index a4dcec51bb563a75db52f24d4ef2f6b7f3c05b90..1ab1c71211f5bcea98c6718a8532e7f73a078adf 100644 (file)
@@ -405,10 +405,7 @@ find_pseudo_copy (rtx set)
 static void
 propagate_pseudo_copies (void)
 {
-  bitmap queue, propagate;
-
-  queue = BITMAP_ALLOC (NULL);
-  propagate = BITMAP_ALLOC (NULL);
+  auto_bitmap queue, propagate;
 
   bitmap_copy (queue, decomposable_context);
   do
@@ -429,9 +426,6 @@ propagate_pseudo_copies (void)
       bitmap_ior_into (decomposable_context, propagate);
     }
   while (!bitmap_empty_p (queue));
-
-  BITMAP_FREE (queue);
-  BITMAP_FREE (propagate);
 }
 
 /* A pointer to one of these values is passed to
index fa4e626fab86cd5866cad4275a649ef274fb413d..0fc9fc5c4667770bb2b8ade0d87e9ef74c71e2e4 100644 (file)
@@ -2396,7 +2396,6 @@ tree_predict_by_opcode (basic_block bb)
   tree type;
   tree val;
   enum tree_code cmp;
-  bitmap visited;
   edge_iterator ei;
   enum br_predictor predictor;
 
@@ -2409,10 +2408,8 @@ tree_predict_by_opcode (basic_block bb)
   op1 = gimple_cond_rhs (stmt);
   cmp = gimple_cond_code (stmt);
   type = TREE_TYPE (op0);
-  visited = BITMAP_ALLOC (NULL);
-  val = expr_expected_value_1 (boolean_type_node, op0, cmp, op1, visited,
+  val = expr_expected_value_1 (boolean_type_node, op0, cmp, op1, auto_bitmap (),
                               &predictor);
-  BITMAP_FREE (visited);
   if (val && TREE_CODE (val) == INTEGER_CST)
     {
       if (predictor == PRED_BUILTIN_EXPECT)
@@ -2917,9 +2914,7 @@ static void
 predict_paths_leading_to (basic_block bb, enum br_predictor pred,
                          enum prediction taken, struct loop *in_loop)
 {
-  bitmap visited = BITMAP_ALLOC (NULL);
-  predict_paths_for_bb (bb, bb, pred, taken, visited, in_loop);
-  BITMAP_FREE (visited);
+  predict_paths_for_bb (bb, bb, pred, taken, auto_bitmap (), in_loop);
 }
 
 /* Like predict_paths_leading_to but take edge instead of basic block.  */
@@ -2943,9 +2938,7 @@ predict_paths_leading_to_edge (edge e, enum br_predictor pred,
       }
   if (!has_nonloop_edge)
     {
-      bitmap visited = BITMAP_ALLOC (NULL);
-      predict_paths_for_bb (bb, bb, pred, taken, visited, in_loop);
-      BITMAP_FREE (visited);
+      predict_paths_for_bb (bb, bb, pred, taken, auto_bitmap (), in_loop);
     }
   else
     predict_edge_def (e, pred, taken);
@@ -3119,7 +3112,7 @@ estimate_loops_at_level (struct loop *first_loop)
       edge e;
       basic_block *bbs;
       unsigned i;
-      bitmap tovisit = BITMAP_ALLOC (NULL);
+      auto_bitmap tovisit;
 
       estimate_loops_at_level (loop->inner);
 
@@ -3132,7 +3125,6 @@ estimate_loops_at_level (struct loop *first_loop)
        bitmap_set_bit (tovisit, bbs[i]->index);
       free (bbs);
       propagate_freq (loop->header, tovisit);
-      BITMAP_FREE (tovisit);
     }
 }
 
@@ -3141,7 +3133,7 @@ estimate_loops_at_level (struct loop *first_loop)
 static void
 estimate_loops (void)
 {
-  bitmap tovisit = BITMAP_ALLOC (NULL);
+  auto_bitmap tovisit;
   basic_block bb;
 
   /* Start by estimating the frequencies in the loops.  */
@@ -3154,7 +3146,6 @@ estimate_loops (void)
       bitmap_set_bit (tovisit, bb->index);
     }
   propagate_freq (ENTRY_BLOCK_PTR_FOR_FN (cfun), tovisit);
-  BITMAP_FREE (tovisit);
 }
 
 /* Drop the profile for NODE to guessed, and update its frequency based on
index 35eb85ba63c0b892e8c6b5defadf5ce2febbbb0d..492376d949b11b6ad6a5f0ec7e77eb420e436bc2 100644 (file)
@@ -758,7 +758,7 @@ try_shrink_wrapping (edge *entry_edge, rtx_insn *prologue_seq)
      reachable from PRO that we already found, and in VEC a stack of
      those we still need to consider (to find successors).  */
 
-  bitmap bb_with = BITMAP_ALLOC (NULL);
+  auto_bitmap bb_with;
   bitmap_set_bit (bb_with, pro->index);
 
   vec<basic_block> vec;
@@ -822,7 +822,7 @@ try_shrink_wrapping (edge *entry_edge, rtx_insn *prologue_seq)
     {
       calculate_dominance_info (CDI_POST_DOMINATORS);
 
-      bitmap bb_tmp = BITMAP_ALLOC (NULL);
+      auto_bitmap bb_tmp;
       bitmap_copy (bb_tmp, bb_with);
       basic_block last_ok = pro;
       vec.truncate (0);
@@ -859,7 +859,6 @@ try_shrink_wrapping (edge *entry_edge, rtx_insn *prologue_seq)
 
       pro = last_ok;
 
-      BITMAP_FREE (bb_tmp);
       free_dominance_info (CDI_POST_DOMINATORS);
     }
 
@@ -871,7 +870,6 @@ try_shrink_wrapping (edge *entry_edge, rtx_insn *prologue_seq)
 
   if (pro == entry)
     {
-      BITMAP_FREE (bb_with);
       free_dominance_info (CDI_DOMINATORS);
       return;
     }
@@ -1006,7 +1004,6 @@ try_shrink_wrapping (edge *entry_edge, rtx_insn *prologue_seq)
   *entry_edge = make_single_succ_edge (new_bb, pro, EDGE_FALLTHRU);
   force_nonfallthru (*entry_edge);
 
-  BITMAP_FREE (bb_with);
   free_dominance_info (CDI_DOMINATORS);
 }
 \f
@@ -1265,7 +1262,7 @@ spread_components (sbitmap components)
      on that stack.  */
   vec<basic_block> todo;
   todo.create (n_basic_blocks_for_fn (cfun));
-  bitmap seen = BITMAP_ALLOC (NULL);
+  auto_bitmap seen;
 
   sbitmap old = sbitmap_alloc (SBITMAP_SIZE (components));
 
@@ -1395,7 +1392,6 @@ spread_components (sbitmap components)
     }
 
   sbitmap_free (old);
-  BITMAP_FREE (seen);
 }
 
 /* If we cannot handle placing some component's prologues or epilogues where
index 72c52840cd4c1eccb8b884bda34328fb57daa3a2..69f6e5ddeeec36afa389754deba5290171fc5111 100644 (file)
@@ -8194,7 +8194,6 @@ remove_edge_and_dominated_blocks (edge e)
 {
   vec<basic_block> bbs_to_remove = vNULL;
   vec<basic_block> bbs_to_fix_dom = vNULL;
-  bitmap df, df_idom;
   edge f;
   edge_iterator ei;
   bool none_removed = false;
@@ -8243,9 +8242,7 @@ remove_edge_and_dominated_blocks (edge e)
        }
     }
 
-  df = BITMAP_ALLOC (NULL);
-  df_idom = BITMAP_ALLOC (NULL);
-
+  auto_bitmap df, df_idom;
   if (none_removed)
     bitmap_set_bit (df_idom,
                    get_immediate_dominator (CDI_DOMINATORS, e->dest)->index);
@@ -8312,8 +8309,6 @@ remove_edge_and_dominated_blocks (edge e)
 
   iterate_fix_dominators (CDI_DOMINATORS, bbs_to_fix_dom, true);
 
-  BITMAP_FREE (df);
-  BITMAP_FREE (df_idom);
   bbs_to_remove.release ();
   bbs_to_fix_dom.release ();
 }
index 1b9950eca8ee9ffebe91da58c2529abb09c9f5c5..a60454b521861da3b503b5a004379aa0e112bef4 100644 (file)
@@ -1251,7 +1251,7 @@ rdg_build_partitions (struct graph *rdg,
                      vec<gimple *> starting_stmts,
                      vec<partition *> *partitions)
 {
-  bitmap processed = BITMAP_ALLOC (NULL);
+  auto_bitmap processed;
   int i;
   gimple *stmt;
 
@@ -1282,8 +1282,6 @@ rdg_build_partitions (struct graph *rdg,
 
   /* All vertices should have been assigned to at least one partition now,
      other than vertices belonging to dead code.  */
-
-  BITMAP_FREE (processed);
 }
 
 /* Dump to FILE the PARTITIONS.  */
index 57d8f7d207c380430da5ebfb0f9f8c0fcf29c2bd..23e7870dd2d5a746799606486c1fb810e44104f9 100644 (file)
@@ -2498,7 +2498,6 @@ tree_predictive_commoning_loop (struct loop *loop)
   struct tree_niter_desc desc;
   bool unroll = false;
   edge exit;
-  bitmap tmp_vars;
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     fprintf (dump_file, "Processing loop %d\n",  loop->num);
@@ -2549,7 +2548,7 @@ tree_predictive_commoning_loop (struct loop *loop)
   /* Find the suitable components and split them into chains.  */
   components = filter_suitable_components (loop, components);
 
-  tmp_vars = BITMAP_ALLOC (NULL);
+  auto_bitmap tmp_vars;
   looparound_phis = BITMAP_ALLOC (NULL);
   determine_roots (loop, components, &chains);
   release_components (components);
@@ -2617,7 +2616,6 @@ tree_predictive_commoning_loop (struct loop *loop)
 end: ;
   release_chains (chains);
   free_data_refs (datarefs);
-  BITMAP_FREE (tmp_vars);
   BITMAP_FREE (looparound_phis);
 
   free_affine_expand_cache (&name_expansions);
index 1b78d66456eec0f455105fcfa650584cca80f90a..e166314ed4d3d0b9a90e279c0a21a8c22b75a5a4 100644 (file)
@@ -1791,7 +1791,7 @@ coalesce_ssa_name (void)
   tree_live_info_p liveinfo;
   ssa_conflicts *graph;
   coalesce_list *cl;
-  bitmap used_in_copies = BITMAP_ALLOC (NULL);
+  auto_bitmap used_in_copies;
   var_map map;
   unsigned int i;
   tree a;
@@ -1848,8 +1848,6 @@ coalesce_ssa_name (void)
   else
     compute_samebase_partition_bases (map);
 
-  BITMAP_FREE (used_in_copies);
-
   if (num_var_partitions (map) < 1)
     {
       delete_coalesce_list (cl);
index f61b269cd63da25c0fe404cd8a02e61a1f69c9d7..aa0f50256cd78002c20b33a683cad10c65621da9 100644 (file)
@@ -497,13 +497,11 @@ public:
 unsigned int
 pass_phi_only_cprop::execute (function *fun)
 {
-  bitmap interesting_names;
-  bitmap interesting_names1;
   bool cfg_altered = false;
 
   /* Bitmap of blocks which need EH information updated.  We can not
      update it on-the-fly as doing so invalidates the dominator tree.  */
-  bitmap need_eh_cleanup = BITMAP_ALLOC (NULL);
+  auto_bitmap need_eh_cleanup;
 
   /* INTERESTING_NAMES is effectively our worklist, indexed by
      SSA_NAME_VERSION.
@@ -515,8 +513,8 @@ pass_phi_only_cprop::execute (function *fun)
 
      Experiments have show we generally get better compilation
      time behavior with bitmaps rather than sbitmaps.  */
-  interesting_names = BITMAP_ALLOC (NULL);
-  interesting_names1 = BITMAP_ALLOC (NULL);
+  auto_bitmap interesting_names;
+  auto_bitmap interesting_names1;
 
   calculate_dominance_info (CDI_DOMINATORS);
   cfg_altered = false;
@@ -570,13 +568,8 @@ pass_phi_only_cprop::execute (function *fun)
   /* Propagation of const and copies may make some EH edges dead.  Purge
      such edges from the CFG as needed.  */
   if (!bitmap_empty_p (need_eh_cleanup))
-    {
-      gimple_purge_all_dead_eh_edges (need_eh_cleanup);
-      BITMAP_FREE (need_eh_cleanup);
-    }
+    gimple_purge_all_dead_eh_edges (need_eh_cleanup);
 
-  BITMAP_FREE (interesting_names);
-  BITMAP_FREE (interesting_names1);
   return 0;
 }
 
index e97fdb42b486fbaabed25b77a18df41ca98ee65a..0d9295c2d117b4eb33beb22a57d259048f239034 100644 (file)
@@ -4910,12 +4910,11 @@ mark_operand_necessary (tree op)
 static void
 remove_dead_inserted_code (void)
 {
-  bitmap worklist;
   unsigned i;
   bitmap_iterator bi;
   gimple *t;
 
-  worklist = BITMAP_ALLOC (NULL);
+  auto_bitmap worklist;
   EXECUTE_IF_SET_IN_BITMAP (inserted_exprs, 0, i, bi)
     {
       t = SSA_NAME_DEF_STMT (ssa_name (i));
@@ -5004,7 +5003,6 @@ remove_dead_inserted_code (void)
     }
   if (to_clear != -1U)
     bitmap_clear_bit (inserted_exprs, to_clear);
-  BITMAP_FREE (worklist);
 }
 
 
index eb8b36095d885fa561bec3c535e8a27d128c9d55..acf832d66f6ffc8200c15ab2de3240d996c8e0a6 100644 (file)
@@ -128,7 +128,7 @@ static basic_block
 nearest_common_dominator_of_uses (def_operand_p def_p, bool *debug_stmts)
 {
   tree var = DEF_FROM_PTR (def_p);
-  bitmap blocks = BITMAP_ALLOC (NULL);
+  auto_bitmap blocks;
   basic_block commondom;
   unsigned int j;
   bitmap_iterator bi;
@@ -158,17 +158,14 @@ nearest_common_dominator_of_uses (def_operand_p def_p, bool *debug_stmts)
 
       /* Short circuit. Nothing dominates the entry block.  */
       if (useblock == ENTRY_BLOCK_PTR_FOR_FN (cfun))
-       {
-         BITMAP_FREE (blocks);
-         return NULL;
-       }
+       return NULL;
+
       bitmap_set_bit (blocks, useblock->index);
     }
   commondom = BASIC_BLOCK_FOR_FN (cfun, bitmap_first_set_bit (blocks));
   EXECUTE_IF_SET_IN_BITMAP (blocks, 0, j, bi)
     commondom = nearest_common_dominator (CDI_DOMINATORS, commondom,
                                          BASIC_BLOCK_FOR_FN (cfun, j));
-  BITMAP_FREE (blocks);
   return commondom;
 }
 
index e30ddd821ed6fa864a058278326f5f9d01d906ff..319826861dcdfdf6cbe157161d4883ccf64e3cc6 100644 (file)
@@ -723,7 +723,7 @@ compute_path_counts (struct redirection_data *rd,
      below to add up the counts of the other edges not included in this jump
      threading path.  */
   struct el *next, *el;
-  bitmap in_edge_srcs = BITMAP_ALLOC (NULL);
+  auto_bitmap in_edge_srcs;
   for (el = rd->incoming_edges; el; el = next)
     {
       next = el->next;
@@ -759,8 +759,6 @@ compute_path_counts (struct redirection_data *rd,
   if (path_in_freq > BB_FREQ_MAX)
     path_in_freq = BB_FREQ_MAX;
 
-  BITMAP_FREE (in_edge_srcs);
-
   /* Now compute the fraction of the total count coming into the first
      path bb that is from the current threading path.  */
   gcov_type total_count = e->dest->count;
@@ -1958,7 +1956,7 @@ mark_threaded_blocks (bitmap threaded_blocks)
 {
   unsigned int i;
   bitmap_iterator bi;
-  bitmap tmp = BITMAP_ALLOC (NULL);
+  auto_bitmap tmp;
   basic_block bb;
   edge e;
   edge_iterator ei;
@@ -2169,8 +2167,6 @@ mark_threaded_blocks (bitmap threaded_blocks)
            }
        }
     }
-
-  BITMAP_FREE (tmp);
 }
 
 
@@ -2436,8 +2432,8 @@ thread_through_all_blocks (bool may_peel_loop_headers)
   bool retval = false;
   unsigned int i;
   bitmap_iterator bi;
-  bitmap threaded_blocks;
   struct loop *loop;
+  auto_bitmap threaded_blocks;
 
   if (!paths.exists ())
     {
@@ -2445,7 +2441,6 @@ thread_through_all_blocks (bool may_peel_loop_headers)
       goto out;
     }
 
-  threaded_blocks = BITMAP_ALLOC (NULL);
   memset (&thread_stats, 0, sizeof (thread_stats));
 
   /* Remove any paths that referenced removed edges.  */
@@ -2578,8 +2573,6 @@ thread_through_all_blocks (bool may_peel_loop_headers)
 
   free_original_copy_tables ();
 
-  BITMAP_FREE (threaded_blocks);
-  threaded_blocks = NULL;
   paths.release ();
 
   if (retval)
index 42e708ed673a81375492c06f5d4e2ba20d3cda97..11f5a2bac9258144cb9704acbbbb4c5d639abae8 100644 (file)
@@ -1022,7 +1022,7 @@ verify_ssa (bool check_modified_stmt, bool check_ssa_operands)
   ssa_op_iter iter;
   tree op;
   enum dom_state orig_dom_state = dom_info_state (CDI_DOMINATORS);
-  bitmap names_defined_in_bb = BITMAP_ALLOC (NULL);
+  auto_bitmap names_defined_in_bb;
 
   gcc_assert (!need_ssa_update_p (cfun));
 
@@ -1176,7 +1176,6 @@ verify_ssa (bool check_modified_stmt, bool check_ssa_operands)
   else
     set_dom_info_availability (CDI_DOMINATORS, orig_dom_state);
 
-  BITMAP_FREE (names_defined_in_bb);
   timevar_pop (TV_TREE_SSA_VERIFY);
   return;
 
@@ -1622,9 +1621,9 @@ void
 execute_update_addresses_taken (void)
 {
   basic_block bb;
-  bitmap addresses_taken = BITMAP_ALLOC (NULL);
-  bitmap not_reg_needs = BITMAP_ALLOC (NULL);
-  bitmap suitable_for_renaming = BITMAP_ALLOC (NULL);
+  auto_bitmap addresses_taken;
+  auto_bitmap not_reg_needs;
+  auto_bitmap suitable_for_renaming;
   tree var;
   unsigned i;
 
@@ -2005,9 +2004,6 @@ execute_update_addresses_taken (void)
        update_ssa (TODO_update_ssa);
     }
 
-  BITMAP_FREE (not_reg_needs);
-  BITMAP_FREE (addresses_taken);
-  BITMAP_FREE (suitable_for_renaming);
   timevar_pop (TV_ADDRESS_TAKEN);
 }
 
index 6487542eb8f36e554be35d9bf1e54be44396ad47..353c7b1906a88ffa7f9d2a368e48209c22bb5c7c 100644 (file)
@@ -127,7 +127,7 @@ verify_ssaname_freelists (struct function *fun)
   if (!gimple_in_ssa_p (fun))
     return;
 
-  bitmap names_in_il = BITMAP_ALLOC (NULL);
+  auto_bitmap names_in_il;
 
   /* Walk the entire IL noting every SSA_NAME we see.  */
   basic_block bb;
@@ -165,7 +165,7 @@ verify_ssaname_freelists (struct function *fun)
 
   /* Now walk the free list noting what we find there and verifying
      there are no duplicates.  */
-  bitmap names_in_freelists = BITMAP_ALLOC (NULL);
+  auto_bitmap names_in_freelists;
   if (FREE_SSANAMES (fun))
     {
       for (unsigned int i = 0; i < FREE_SSANAMES (fun)->length (); i++)
@@ -221,7 +221,7 @@ verify_ssaname_freelists (struct function *fun)
 
   unsigned int i;
   bitmap_iterator bi;
-  bitmap all_names = BITMAP_ALLOC (NULL);
+  auto_bitmap all_names;
   bitmap_set_range (all_names, UNUSED_NAME_VERSION + 1, num_ssa_names - 1);
   bitmap_ior_into (names_in_il, names_in_freelists);
 
@@ -230,10 +230,6 @@ verify_ssaname_freelists (struct function *fun)
   EXECUTE_IF_AND_COMPL_IN_BITMAP(all_names, names_in_il,
                                 UNUSED_NAME_VERSION + 1, i, bi)
     gcc_assert (!ssa_name (i));
-
-  BITMAP_FREE (all_names);
-  BITMAP_FREE (names_in_freelists);
-  BITMAP_FREE (names_in_il);
 }
 
 /* Move all SSA_NAMEs from FREE_SSA_NAMES_QUEUE to FREE_SSA_NAMES.