aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-12-18 15:31:38 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-12-18 15:31:38 +0000
commitc82e0b3b1b7794f9903ab0b82ecaeabcd0d3a565 (patch)
tree1a983ee434466a8c4dd0a7ac0d715f881943062f /gcc
parentd88cf0ceb35a0690bcb2d0008c048d3de6aedcca (diff)
downloadgcc-c82e0b3b1b7794f9903ab0b82ecaeabcd0d3a565.zip
gcc-c82e0b3b1b7794f9903ab0b82ecaeabcd0d3a565.tar.gz
gcc-c82e0b3b1b7794f9903ab0b82ecaeabcd0d3a565.tar.bz2
tree-ssa-sccvn.c (copy_nary): New function.
2009-12-18 Richard Guenther <rguenther@suse.de> * 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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/tree-ssa-sccvn.c62
2 files changed, 67 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c74baf6..3480920 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2009-12-18 Richard Guenther <rguenther@suse.de>
+
+ * 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 <jakub@redhat.com>
* 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 2027357..058da5c9 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 (&current_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);
}
}