RFA: Improve jump threading 5 of N

2011-05-05 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


I should have included these in the last patch of infrastructure changes.

The main change is create_block_for_threading no longer calls
remove_ctrl_stmt_and_useless_edges and instead its callers are expected
to handle that, when needed.  This will allow me to use
create_block_for_threading to duplicate the join block in a future patch.

Additionally there was another place I should have been using a macro to
access the edges stored in the aux field.

Bootstrapped and regression tested on x86_64-unknown-linux-gnu.  OK for
trunk?

Thanks,
Jeff
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNwswlAAoJEBRtltQi2kC72U4H/Rup77S9Pi2bZgkT8k1wEY7x
+teD8FOKAW52dhfFrYmI8pmOBsmC8WTvn3WlOX+a0/+eB+j2aX3OITDYAzxinu45
6w+5jBHw96iJ3IvI1HIg6wsXo0HEJW40z6OeyPR06xz9AUh2xtJCh5Mh5WCC66Qf
SPisgr/w5wteuHpDT/URsW/cPfhTS26SeB5x61QAXM7wwXDETBnI5nX+kGtZ7zTG
x0qslTTePWvpYj4OqtlYzUSC/a0qKhc724ZRBsRlME+OQ/ClGh0ikAWD1kzjU899
AmtrUWYf/NpYRe1XKLmylcAhN5qwYJ7rGNL5AdgD0lCzkjic63axOb9t3z6d3aY=
=yU+L
-END PGP SIGNATURE-
* tree-ssa-threadupdate.c (create_block_for_threading): Do not call
remove_ctrl_stmt_and_useless_edges.
(create_duplicates): Call remove_ctrl_stmt_and_useless_edges.
(fixup_template_block, thread_single_edge): Likewise.
(mark_threaded_blocks): Use THREAD_TARGET.

Index: tree-ssa-threadupdate.c
===
*** tree-ssa-threadupdate.c (revision 173394)
--- tree-ssa-threadupdate.c (working copy)
*** remove_ctrl_stmt_and_useless_edges (basi
*** 198,205 
  }
  }
  
! /* Create a duplicate of BB which only reaches the destination of the edge
!stored in RD.  Record the duplicate block in RD.  */
  
  static void
  create_block_for_threading (basic_block bb, struct redirection_data *rd)
--- 198,204 
  }
  }
  
! /* Create a duplicate of BB.  Record the duplicate block in RD.  */
  
  static void
  create_block_for_threading (basic_block bb, struct redirection_data *rd)
*** create_block_for_threading (basic_block 
*** 217,230 
/* Zero out the profile, since the block is unreachable for now.  */
rd->dup_block->frequency = 0;
rd->dup_block->count = 0;
- 
-   /* The call to duplicate_block will copy everything, including the
-  useless COND_EXPR or SWITCH_EXPR at the end of BB.  We just remove
-  the useless COND_EXPR or SWITCH_EXPR here rather than having a
-  specialized block copier.  We also remove all outgoing edges
-  from the duplicate block.  The appropriate edge will be created
-  later.  */
-   remove_ctrl_stmt_and_useless_edges (rd->dup_block, NULL);
  }
  
  /* Hashing and equality routines for our hash table.  */
--- 216,221 
*** create_duplicates (void **slot, void *da
*** 375,380 
--- 366,372 
  
/* Go ahead and wire up outgoing edges and update PHIs for the duplicate
   block.  */
+   remove_ctrl_stmt_and_useless_edges (rd->dup_block, NULL);
create_edge_and_update_destination_phis (rd, rd->dup_block);
  }
  
*** fixup_template_block (void **slot, void 
*** 396,401 
--- 388,394 
   and halt the hash table traversal.  */
if (rd->dup_block && rd->dup_block == local_info->template_block)
  {
+   remove_ctrl_stmt_and_useless_edges (rd->dup_block, NULL);
create_edge_and_update_destination_phis (rd, rd->dup_block);
return 0;
  }
*** thread_single_edge (edge e)
*** 646,651 
--- 639,645 
rd.outgoing_edge = eto;
  
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);
  
if (dump_file && (dump_flags & TDF_DETAILS))
*** mark_threaded_blocks (bitmap threaded_bl
*** 978,985 
edge e = VEC_index (edge, threaded_edges, i);
edge *x = (edge *) XNEWVEC (edge, 1);
  
-   x[0] = VEC_index (edge, threaded_edges, i + 1);
e->aux = x;
bitmap_set_bit (tmp, e->dest->index);
  }
  
--- 972,979 
edge e = VEC_index (edge, threaded_edges, i);
edge *x = (edge *) XNEWVEC (edge, 1);
  
e->aux = x;
+   THREAD_TARGET (e) = VEC_index (edge, threaded_edges, i + 1);
bitmap_set_bit (tmp, e->dest->index);
  }
  


Re: RFA: Improve jump threading 5 of N

2011-05-06 Thread Richard Guenther
On Thu, May 5, 2011 at 6:11 PM, Jeff Law  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
>
> I should have included these in the last patch of infrastructure changes.
>
> The main change is create_block_for_threading no longer calls
> remove_ctrl_stmt_and_useless_edges and instead its callers are expected
> to handle that, when needed.  This will allow me to use
> create_block_for_threading to duplicate the join block in a future patch.
>
> Additionally there was another place I should have been using a macro to
> access the edges stored in the aux field.
>
> Bootstrapped and regression tested on x86_64-unknown-linux-gnu.  OK for
> trunk?

Ok.

Thanks,
Richard.

> Thanks,
> Jeff
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
>
> iQEcBAEBAgAGBQJNwswlAAoJEBRtltQi2kC72U4H/Rup77S9Pi2bZgkT8k1wEY7x
> +teD8FOKAW52dhfFrYmI8pmOBsmC8WTvn3WlOX+a0/+eB+j2aX3OITDYAzxinu45
> 6w+5jBHw96iJ3IvI1HIg6wsXo0HEJW40z6OeyPR06xz9AUh2xtJCh5Mh5WCC66Qf
> SPisgr/w5wteuHpDT/URsW/cPfhTS26SeB5x61QAXM7wwXDETBnI5nX+kGtZ7zTG
> x0qslTTePWvpYj4OqtlYzUSC/a0qKhc724ZRBsRlME+OQ/ClGh0ikAWD1kzjU899
> AmtrUWYf/NpYRe1XKLmylcAhN5qwYJ7rGNL5AdgD0lCzkjic63axOb9t3z6d3aY=
> =yU+L
> -END PGP SIGNATURE-
>