OSDN Git Service

2009-12-18 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 18 Dec 2009 15:31:38 +0000 (15:31 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 18 Dec 2009 15:31:38 +0000 (15:31 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155346 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-ssa-sccvn.c

index c74baf6..3480920 100644 (file)
@@ -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
index 2027357..058da5c 100644 (file)
@@ -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);
     }
 }