+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
+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.
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))
{
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;
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)
{
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;
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;
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;
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. */
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:
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:
/* 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. */
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);
}
(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);
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
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);
{
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
}
}
- 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). */
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);
/* 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>
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;
}
/* 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. */
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 ();
}
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
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,
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);
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)
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. */