From: Richard Guenther Date: Fri, 18 Dec 2009 15:31:38 +0000 (+0000) Subject: tree-ssa-sccvn.c (copy_nary): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c82e0b3b1b7794f9903ab0b82ecaeabcd0d3a565;p=gcc.git tree-ssa-sccvn.c (copy_nary): New function. 2009-12-18 Richard Guenther * tree-ssa-sccvn.c (copy_nary): New function. (copy_phis): Likewise. (copy_references): Likewise. (process_scc): Avoid last iteration by copying the optimistic table to the valid table. From-SVN: r155346 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c74baf6b393..34809207012 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2009-12-18 Richard Guenther + + * tree-ssa-sccvn.c (copy_nary): New function. + (copy_phis): Likewise. + (copy_references): Likewise. + (process_scc): Avoid last iteration by copying the + optimistic table to the valid table. + 2009-12-17 Jakub Jelinek * dwarf2out.c (loc_descriptor): For SYMBOL_REFs and LABEL_REFs diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 2027357fd63..058da5c97a5 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -2737,6 +2737,60 @@ sort_scc (VEC (tree, heap) *scc) compare_ops); } +/* Insert the no longer used nary *ENTRY to the current hash. */ + +static int +copy_nary (void **entry, void *data ATTRIBUTE_UNUSED) +{ + vn_nary_op_t onary = (vn_nary_op_t) *entry; + size_t size = (sizeof (struct vn_nary_op_s) + - sizeof (tree) * (4 - onary->length)); + vn_nary_op_t nary = (vn_nary_op_t) obstack_alloc (¤t_info->nary_obstack, + size); + void **slot; + memcpy (nary, onary, size); + slot = htab_find_slot_with_hash (current_info->nary, nary, nary->hashcode, + INSERT); + gcc_assert (!*slot); + *slot = nary; + return 1; +} + +/* Insert the no longer used phi *ENTRY to the current hash. */ + +static int +copy_phis (void **entry, void *data ATTRIBUTE_UNUSED) +{ + vn_phi_t ophi = (vn_phi_t) *entry; + vn_phi_t phi = (vn_phi_t) pool_alloc (current_info->phis_pool); + void **slot; + memcpy (phi, ophi, sizeof (*phi)); + ophi->phiargs = NULL; + slot = htab_find_slot_with_hash (current_info->phis, phi, phi->hashcode, + INSERT); + *slot = phi; + return 1; +} + +/* Insert the no longer used reference *ENTRY to the current hash. */ + +static int +copy_references (void **entry, void *data ATTRIBUTE_UNUSED) +{ + vn_reference_t oref = (vn_reference_t) *entry; + vn_reference_t ref; + void **slot; + ref = (vn_reference_t) pool_alloc (current_info->references_pool); + memcpy (ref, oref, sizeof (*ref)); + oref->operands = NULL; + slot = htab_find_slot_with_hash (current_info->references, ref, ref->hashcode, + INSERT); + if (*slot) + free_reference (*slot); + *slot = ref; + return 1; +} + /* Process a strongly connected component in the SSA graph. */ static void @@ -2782,10 +2836,12 @@ process_scc (VEC (tree, heap) *scc) statistics_histogram_event (cfun, "SCC iterations", iterations); - /* Finally, visit the SCC once using the valid table. */ + /* Finally, copy the contents of the no longer used optimistic + table to the valid table. */ current_info = valid_info; - for (i = 0; VEC_iterate (tree, scc, i, var); i++) - visit_use (var); + htab_traverse (optimistic_info->nary, copy_nary, NULL); + htab_traverse (optimistic_info->phis, copy_phis, NULL); + htab_traverse (optimistic_info->references, copy_references, NULL); } }