This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Cleaning up comments and indention fix in tree-ssa-threadupdate.c


Just some preparatory work.  Just comments and an indention fix.

Installed on the trunk.



diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index e819d65..eb733b2 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -73,19 +73,16 @@ along with GCC; see the file COPYING3.  If not see
    set of unique destination blocks that the incoming edges should
    be threaded to.
 
-   Block duplication can be further minimized by using B instead of
-   creating B' for one destination if all edges into B are going to be
-   threaded to a successor of B.  We had code to do this at one time, but
-   I'm not convinced it is correct with the changes to avoid mucking up
-   the loop structure (which may cancel threading requests, thus a block
-   which we thought was going to become unreachable may still be reachable).
-   This code was also going to get ugly with the introduction of the ability
-   for a single jump thread request to bypass multiple blocks.
+   We reduce the number of edges and statements we create by not copying all
+   the outgoing edges and the control statement in step #1.  We instead create
+   a template block without the outgoing edges and duplicate the template.
 
-   We further reduce the number of edges and statements we create by
-   not copying all the outgoing edges and the control statement in
-   step #1.  We instead create a template block without the outgoing
-   edges and duplicate the template.  */
+   Another case this code handles is threading through a "joiner" block.  In
+   this case, we do not know the destination of the joiner block, but one
+   of the outgoing edges from the joiner block leads to a threadable path.  This
+   case largely works as outlined above, except the duplicate of the joiner
+   block still contains a full set of outgoing edges and its control statement.
+   We just redirect one of its outgoing edges to our jump threading path.  */
 
 
 /* Steps #5 and #6 of the above algorithm are best implemented by walking
@@ -357,18 +354,13 @@ update_destination_phis (basic_block orig_bb, basic_block new_bb)
     }
 }
 
-/* Given a duplicate block and its single destination (both stored
-   in RD).  Create an edge between the duplicate and its single
-   destination.
-
-   Add an additional argument to any PHI nodes at the single
-   destination.  */
+/* Create an edge between BB and DEST_EDGE->dest.  Add additional arguments
+   to any PHI nodes at DEST_EDGE->dest as needed.  */
 
 static void
-create_edge_and_update_destination_phis (struct redirection_data *rd,
-					 basic_block bb)
+create_edge_and_update_destination_phis (basic_block bb, edge dest_edge)
 {
-  edge e = make_edge (bb, rd->path->last ()->e->dest, EDGE_FALLTHRU);
+  edge e = make_edge (bb, dest_edge->dest, EDGE_FALLTHRU);
 
   rescan_loop_exit (e, true, false);
   e->probability = REG_BR_PROB_BASE;
@@ -376,9 +368,9 @@ create_edge_and_update_destination_phis (struct redirection_data *rd,
 
   /* We have to copy path -- which means creating a new vector as well
      as all the jump_thread_edge entries.  */
-  if (rd->path->last ()->e->aux)
+  if (dest_edge->aux)
     {
-      vec<jump_thread_edge *> *path = THREAD_PATH (rd->path->last ()->e);
+      vec<jump_thread_edge *> *path = THREAD_PATH (dest_edge);
       vec<jump_thread_edge *> *copy = new vec<jump_thread_edge *> ();
 
       /* Sadly, the elements of the vector are pointers and need to
@@ -389,7 +381,7 @@ create_edge_and_update_destination_phis (struct redirection_data *rd,
 	    = new jump_thread_edge ((*path)[i]->e, (*path)[i]->type);
 	  copy->safe_push (x);
 	}
-     e->aux = (void *)copy;
+      e->aux = (void *)copy;
     }
   else
     {
@@ -400,10 +392,10 @@ create_edge_and_update_destination_phis (struct redirection_data *rd,
      from the duplicate block, then we will need to add a new argument
      to them.  The argument should have the same value as the argument
      associated with the outgoing edge stored in RD.  */
-  copy_phi_args (e->dest, rd->path->last ()->e, e);
+  copy_phi_args (e->dest, dest_edge, e);
 }
 
-/* Wire up the outgoing edges from the duplicate block and
+/* Wire up the outgoing edges from the duplicate blocks and
    update any PHIs as needed.  */
 void
 ssa_fix_duplicate_block_edges (struct redirection_data *rd,
@@ -440,7 +432,7 @@ ssa_fix_duplicate_block_edges (struct redirection_data *rd,
   else
     {
       remove_ctrl_stmt_and_useless_edges (rd->dup_block, NULL);
-      create_edge_and_update_destination_phis (rd, rd->dup_block);
+      create_edge_and_update_destination_phis (rd->dup_block, path->last ()->e);
     }
 }
 /* Hash table traversal callback routine to create duplicate blocks.  */
@@ -481,7 +473,7 @@ ssa_create_duplicates (struct redirection_data **slot,
 
 inline int
 ssa_fixup_template_block (struct redirection_data **slot,
-			  ssa_local_info_t *local_info)
+			   ssa_local_info_t *local_info)
 {
   struct redirection_data *rd = *slot;
 
@@ -832,7 +824,7 @@ thread_single_edge (edge e)
 
   create_block_for_threading (bb, &rd);
   remove_ctrl_stmt_and_useless_edges (rd.dup_block, NULL);
-  create_edge_and_update_destination_phis (&rd, rd.dup_block);
+  create_edge_and_update_destination_phis (rd.dup_block, npath->last ()->e);
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     fprintf (dump_file, "  Threaded jump %d --> %d to %d\n",

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]