static vn_reference_t last_inserted_ref;
static vn_phi_t last_inserted_phi;
static vn_nary_op_t last_inserted_nary;
+static vn_ssa_aux_t last_pushed_avail;
/* Valid hashtables storing information we have proven to be
correct. */
av->location = bb->index;
av->leader = SSA_NAME_VERSION (leader);
av->next = value->avail;
+ av->next_undo = last_pushed_avail;
+ last_pushed_avail = value;
value->avail = av;
}
vn_reference_t ref_top;
vn_phi_t phi_top;
vn_nary_op_t nary_top;
+ vn_avail *avail_top;
};
/* Unwind the RPO VN state for iteration. */
static void
-do_unwind (unwind_state *to, int rpo_idx, rpo_elim &avail, int *bb_to_rpo)
+do_unwind (unwind_state *to, rpo_elim &avail)
{
gcc_assert (to->iterate);
for (; last_inserted_nary != to->nary_top;
obstack_free (&vn_tables_obstack, to->ob_top);
/* Prune [rpo_idx, ] from avail. */
- /* ??? This is O(number-of-values-in-region) which is
- O(region-size) rather than O(iteration-piece). */
- for (hash_table<vn_ssa_aux_hasher>::iterator i = vn_ssa_aux_hash->begin ();
- i != vn_ssa_aux_hash->end (); ++i)
+ for (; last_pushed_avail && last_pushed_avail->avail != to->avail_top;)
{
- while ((*i)->avail)
- {
- if (bb_to_rpo[(*i)->avail->location] < rpo_idx)
- break;
- vn_avail *av = (*i)->avail;
- (*i)->avail = (*i)->avail->next;
- av->next = avail.m_avail_freelist;
- avail.m_avail_freelist = av;
- }
+ vn_ssa_aux_t val = last_pushed_avail;
+ vn_avail *av = val->avail;
+ val->avail = av->next;
+ last_pushed_avail = av->next_undo;
+ av->next = avail.m_avail_freelist;
+ avail.m_avail_freelist = av;
}
}
last_inserted_ref = NULL;
last_inserted_phi = NULL;
last_inserted_nary = NULL;
+ last_pushed_avail = NULL;
vn_valueize = rpo_vn_valueize;
rpo_state[idx].ref_top = last_inserted_ref;
rpo_state[idx].phi_top = last_inserted_phi;
rpo_state[idx].nary_top = last_inserted_nary;
+ rpo_state[idx].avail_top
+ = last_pushed_avail ? last_pushed_avail->avail : NULL;
}
if (!(bb->flags & BB_EXECUTABLE))
}
if (iterate_to != -1)
{
- do_unwind (&rpo_state[iterate_to], iterate_to, avail, bb_to_rpo);
+ do_unwind (&rpo_state[iterate_to], avail);
idx = iterate_to;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Iterating to %d BB%d\n",