Come up with is_empty for hash_{table,map,set}.
2019-05-03 Martin Liska <mliska@suse.cz> * hash-map.h: Add is_empty function. * hash-set.h: Likewise. * hash-table.h: Likewise. * dwarf2out.c (dwarf2out_finish): Use is_empty instead of elements () == 0 (and similar usages). * gimple-ssa-store-merging.c (pass_store_merging::terminate_and_process_all_chains): Likewise. * gimplify.c (gimplify_bind_expr): Likewise. (gimplify_switch_expr): Likewise. * hash-map-tests.c (test_map_of_strings_to_int): Likewise. * ipa-icf.c (sem_item_optimizer::remove_symtab_node): Likewise. * postreload-gcse.c (dump_hash_table): Likewise. (gcse_after_reload_main): Likewise. * predict.c (combine_predictions_for_bb): Likewise. * tree-parloops.c (reduction_phi): Likewise. (separate_decls_in_region): Likewise. (transform_to_exit_first_loop): Likewise. (gen_parallel_loop): Likewise. (gather_scalar_reductions): Likewise. (try_create_reduction_list): Likewise. * var-tracking.c (dump_vars): Likewise. (emit_notes_for_changes): Likewise. (vt_emit_notes): Likewise. 2019-05-03 Martin Liska <mliska@suse.cz> * call.c (build_aggr_conv): Use is_empty instead of elements () == 0 (and similar usages). * parser.c (cp_parser_lambda_introducer): Likewise. From-SVN: r270851
This commit is contained in:
parent
3353ebf0d9
commit
b119c05542
|
@ -1,3 +1,28 @@
|
|||
2019-05-03 Martin Liska <mliska@suse.cz>
|
||||
|
||||
* hash-map.h: Add is_empty function.
|
||||
* hash-set.h: Likewise.
|
||||
* hash-table.h: Likewise.
|
||||
* dwarf2out.c (dwarf2out_finish): Use is_empty instead of
|
||||
elements () == 0 (and similar usages).
|
||||
* gimple-ssa-store-merging.c (pass_store_merging::terminate_and_process_all_chains): Likewise.
|
||||
* gimplify.c (gimplify_bind_expr): Likewise.
|
||||
(gimplify_switch_expr): Likewise.
|
||||
* hash-map-tests.c (test_map_of_strings_to_int): Likewise.
|
||||
* ipa-icf.c (sem_item_optimizer::remove_symtab_node): Likewise.
|
||||
* postreload-gcse.c (dump_hash_table): Likewise.
|
||||
(gcse_after_reload_main): Likewise.
|
||||
* predict.c (combine_predictions_for_bb): Likewise.
|
||||
* tree-parloops.c (reduction_phi): Likewise.
|
||||
(separate_decls_in_region): Likewise.
|
||||
(transform_to_exit_first_loop): Likewise.
|
||||
(gen_parallel_loop): Likewise.
|
||||
(gather_scalar_reductions): Likewise.
|
||||
(try_create_reduction_list): Likewise.
|
||||
* var-tracking.c (dump_vars): Likewise.
|
||||
(emit_notes_for_changes): Likewise.
|
||||
(vt_emit_notes): Likewise.
|
||||
|
||||
2019-05-03 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/90316
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2019-05-03 Martin Liska <mliska@suse.cz>
|
||||
|
||||
* call.c (build_aggr_conv): Use is_empty instead of
|
||||
elements () == 0 (and similar usages).
|
||||
* parser.c (cp_parser_lambda_introducer): Likewise.
|
||||
|
||||
2019-05-02 Nathan Sidwell <nathan@acm.org>
|
||||
|
||||
* semantics.c (finish_id_expression_1): Remove unreachable code.
|
||||
|
|
|
@ -986,7 +986,7 @@ build_aggr_conv (tree type, tree ctor, int flags, tsubst_flags_t complain)
|
|||
tree val;
|
||||
bool ok;
|
||||
|
||||
if (pset.elements () && field_in_pset (pset, field))
|
||||
if (!pset.is_empty () && field_in_pset (pset, field))
|
||||
continue;
|
||||
if (i < CONSTRUCTOR_NELTS (ctor))
|
||||
{
|
||||
|
|
|
@ -10769,7 +10769,7 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr)
|
|||
Optimize for the zero or one explicit captures cases and only create
|
||||
the hash_set after adding second capture. */
|
||||
bool found = false;
|
||||
if (ids.elements ())
|
||||
if (!ids.is_empty ())
|
||||
found = ids.add (capture_id);
|
||||
else if (first_capture_id == NULL_TREE)
|
||||
first_capture_id = capture_id;
|
||||
|
|
|
@ -31321,7 +31321,7 @@ dwarf2out_finish (const char *filename)
|
|||
flush_limbo_die_list ();
|
||||
|
||||
if (inline_entry_data_table)
|
||||
gcc_assert (inline_entry_data_table->elements () == 0);
|
||||
gcc_assert (inline_entry_data_table->is_empty ());
|
||||
|
||||
if (flag_checking)
|
||||
{
|
||||
|
|
|
@ -2150,7 +2150,7 @@ pass_store_merging::terminate_and_process_all_chains ()
|
|||
bool ret = false;
|
||||
while (m_stores_head)
|
||||
ret |= terminate_and_release_chain (m_stores_head);
|
||||
gcc_assert (m_stores.elements () == 0);
|
||||
gcc_assert (m_stores.is_empty ());
|
||||
gcc_assert (m_stores_head == NULL);
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -1423,7 +1423,7 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
|
|||
|
||||
oacc_declare_returns->remove (t);
|
||||
|
||||
if (oacc_declare_returns->elements () == 0)
|
||||
if (oacc_declare_returns->is_empty ())
|
||||
{
|
||||
delete oacc_declare_returns;
|
||||
oacc_declare_returns = NULL;
|
||||
|
@ -2418,7 +2418,7 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p)
|
|||
|
||||
if (gimplify_ctxp->live_switch_vars)
|
||||
{
|
||||
gcc_assert (gimplify_ctxp->live_switch_vars->elements () == 0);
|
||||
gcc_assert (gimplify_ctxp->live_switch_vars->is_empty ());
|
||||
delete gimplify_ctxp->live_switch_vars;
|
||||
}
|
||||
gimplify_ctxp->live_switch_vars = saved_live_switch_vars;
|
||||
|
|
|
@ -53,7 +53,7 @@ test_map_of_strings_to_int ()
|
|||
const char *eric = "half a bee";
|
||||
|
||||
/* A fresh hash_map should be empty. */
|
||||
ASSERT_EQ (0, m.elements ());
|
||||
ASSERT_TRUE (m.is_empty ());
|
||||
ASSERT_EQ (NULL, m.get (ostrich));
|
||||
|
||||
/* Populate the hash_map. */
|
||||
|
|
|
@ -211,6 +211,9 @@ public:
|
|||
|
||||
void empty () { m_table.empty(); }
|
||||
|
||||
/* Return true when there are no elements in this hash map. */
|
||||
bool is_empty () const { return m_table.is_empty (); }
|
||||
|
||||
class iterator
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -88,6 +88,9 @@ public:
|
|||
|
||||
void empty () { m_table.empty (); }
|
||||
|
||||
/* Return true when there are no elements in this hash set. */
|
||||
bool is_empty () const { return m_table.is_empty (); }
|
||||
|
||||
class iterator
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -402,6 +402,9 @@ public:
|
|||
/* This function clears all entries in this hash table. */
|
||||
void empty () { if (elements ()) empty_slow (); }
|
||||
|
||||
/* Return true when there are no elements in this hash table. */
|
||||
bool is_empty () const { return elements () == 0; }
|
||||
|
||||
/* This function clears a specified SLOT in a hash table. It is
|
||||
useful when you've already done the lookup and don't want to do it
|
||||
again. */
|
||||
|
|
|
@ -2475,7 +2475,7 @@ sem_item_optimizer::varpool_removal_hook (varpool_node *node, void *data)
|
|||
void
|
||||
sem_item_optimizer::remove_symtab_node (symtab_node *node)
|
||||
{
|
||||
gcc_assert (!m_classes.elements ());
|
||||
gcc_assert (m_classes.is_empty ());
|
||||
|
||||
m_removed_items_set.add (node);
|
||||
}
|
||||
|
|
|
@ -504,7 +504,7 @@ dump_hash_table (FILE *file)
|
|||
(long) expr_table->size (),
|
||||
(long) expr_table->elements (),
|
||||
expr_table->collisions ());
|
||||
if (expr_table->elements () > 0)
|
||||
if (!expr_table->is_empty ())
|
||||
{
|
||||
fprintf (file, "\n\ntable entries:\n");
|
||||
expr_table->traverse <FILE *, dump_expr_hash_table_entry> (file);
|
||||
|
@ -1386,7 +1386,7 @@ gcse_after_reload_main (rtx f ATTRIBUTE_UNUSED)
|
|||
if (dump_file)
|
||||
dump_hash_table (dump_file);
|
||||
|
||||
if (expr_table->elements () > 0)
|
||||
if (!expr_table->is_empty ())
|
||||
{
|
||||
/* Knowing which MEMs are transparent through a block can signifiantly
|
||||
increase the number of redundant loads found. So compute transparency
|
||||
|
|
|
@ -1252,7 +1252,7 @@ combine_predictions_for_bb (basic_block bb, bool dry_run)
|
|||
if (dump_file)
|
||||
{
|
||||
fprintf (dump_file, "Predictions for bb %i\n", bb->index);
|
||||
if (unlikely_edges.elements () == 0)
|
||||
if (unlikely_edges.is_empty ())
|
||||
fprintf (dump_file,
|
||||
"%i edges in bb %i predicted to even probabilities\n",
|
||||
nedges, bb->index);
|
||||
|
|
|
@ -238,7 +238,7 @@ reduction_phi (reduction_info_table_type *reduction_list, gimple *phi)
|
|||
{
|
||||
struct reduction_info tmpred, *red;
|
||||
|
||||
if (reduction_list->elements () == 0 || phi == NULL)
|
||||
if (reduction_list->is_empty () || phi == NULL)
|
||||
return NULL;
|
||||
|
||||
if (gimple_uid (phi) == (unsigned int)-1
|
||||
|
@ -1390,7 +1390,7 @@ separate_decls_in_region (edge entry, edge exit,
|
|||
}
|
||||
}
|
||||
|
||||
if (name_copies.elements () == 0 && reduction_list->elements () == 0)
|
||||
if (name_copies.is_empty () && reduction_list->is_empty ())
|
||||
{
|
||||
/* It may happen that there is nothing to copy (if there are only
|
||||
loop carried and external variables in the loop). */
|
||||
|
@ -1407,7 +1407,7 @@ separate_decls_in_region (edge entry, edge exit,
|
|||
TYPE_NAME (type) = type_name;
|
||||
|
||||
name_copies.traverse <tree, add_field_for_name> (type);
|
||||
if (reduction_list && reduction_list->elements () > 0)
|
||||
if (reduction_list && !reduction_list->is_empty ())
|
||||
{
|
||||
/* Create the fields for reductions. */
|
||||
reduction_list->traverse <tree, add_field_for_reduction> (type);
|
||||
|
@ -1430,7 +1430,7 @@ separate_decls_in_region (edge entry, edge exit,
|
|||
|
||||
/* Load the calculation from memory (after the join of the threads). */
|
||||
|
||||
if (reduction_list && reduction_list->elements () > 0)
|
||||
if (reduction_list && !reduction_list->is_empty ())
|
||||
{
|
||||
reduction_list
|
||||
->traverse <struct clsn_data *, create_stores_for_reduction>
|
||||
|
@ -1991,7 +1991,7 @@ transform_to_exit_first_loop (struct loop *loop,
|
|||
PHI_RESULT of this phi is the resulting value of the reduction
|
||||
variable when exiting the loop. */
|
||||
|
||||
if (reduction_list->elements () > 0)
|
||||
if (!reduction_list->is_empty ())
|
||||
{
|
||||
struct reduction_info *red;
|
||||
|
||||
|
@ -2440,7 +2440,7 @@ gen_parallel_loop (struct loop *loop,
|
|||
}
|
||||
|
||||
/* Generate initializations for reductions. */
|
||||
if (reduction_list->elements () > 0)
|
||||
if (!reduction_list->is_empty ())
|
||||
reduction_list->traverse <struct loop *, initialize_reductions> (loop);
|
||||
|
||||
/* Eliminate the references to local variables from the loop. */
|
||||
|
@ -2476,7 +2476,7 @@ gen_parallel_loop (struct loop *loop,
|
|||
loc = gimple_location (cond_stmt);
|
||||
create_parallel_loop (loop, create_loop_fn (loc), arg_struct, new_arg_struct,
|
||||
n_threads, loc, oacc_kernels_p);
|
||||
if (reduction_list->elements () > 0)
|
||||
if (!reduction_list->is_empty ())
|
||||
create_call_for_reduction (loop, reduction_list, &clsn_data);
|
||||
|
||||
scev_reset ();
|
||||
|
@ -2679,7 +2679,7 @@ gather_scalar_reductions (loop_p loop, reduction_info_table_type *reduction_list
|
|||
}
|
||||
|
||||
gather_done:
|
||||
if (reduction_list->elements () == 0)
|
||||
if (reduction_list->is_empty ())
|
||||
return;
|
||||
|
||||
/* As gimple_uid is used by the vectorizer in between vect_analyze_loop_form
|
||||
|
@ -2806,7 +2806,7 @@ try_create_reduction_list (loop_p loop,
|
|||
fprintf (dump_file,
|
||||
" checking if it is part of reduction pattern:\n");
|
||||
}
|
||||
if (reduction_list->elements () == 0)
|
||||
if (reduction_list->is_empty ())
|
||||
{
|
||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
fprintf (dump_file,
|
||||
|
|
|
@ -7332,7 +7332,7 @@ dump_var (variable *var)
|
|||
static void
|
||||
dump_vars (variable_table_type *vars)
|
||||
{
|
||||
if (vars->elements () > 0)
|
||||
if (!vars->is_empty ())
|
||||
{
|
||||
fprintf (dump_file, "Variables:\n");
|
||||
vars->traverse <void *, dump_var_tracking_slot> (NULL);
|
||||
|
@ -9060,7 +9060,7 @@ emit_notes_for_changes (rtx_insn *insn, enum emit_note_where where,
|
|||
emit_note_data data;
|
||||
variable_table_type *htab = shared_hash_htab (vars);
|
||||
|
||||
if (!changed_variables->elements ())
|
||||
if (changed_variables->is_empty ())
|
||||
return;
|
||||
|
||||
if (MAY_HAVE_DEBUG_BIND_INSNS)
|
||||
|
@ -9538,7 +9538,7 @@ vt_emit_notes (void)
|
|||
basic_block bb;
|
||||
dataflow_set cur;
|
||||
|
||||
gcc_assert (!changed_variables->elements ());
|
||||
gcc_assert (changed_variables->is_empty ());
|
||||
|
||||
/* Free memory occupied by the out hash tables, as they aren't used
|
||||
anymore. */
|
||||
|
|
Loading…
Reference in New Issue