This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Emit jump threading stats
- From: Diego Novillo <dnovillo at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 7 Jun 2005 18:43:18 -0400
- Subject: Emit jump threading stats
Based on advice from Jeff. Tested on x86.
Diego.
* tree-ssa-threadupdate.c (struct thread_stats_d): Declare.
(thread_stats): New local variable.
(redirect_edges): Increment count of threaded edges.
(thread_through_all_blocks): Initialize thread_stats.
Display number of threaded jumps if TDF_STATS is enabled.
Index: tree-ssa-threadupdate.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-threadupdate.c,v
retrieving revision 2.29
diff -d -u -p -r2.29 tree-ssa-threadupdate.c
--- tree-ssa-threadupdate.c 1 Jun 2005 02:51:05 -0000 2.29
+++ tree-ssa-threadupdate.c 7 Jun 2005 20:43:07 -0000
@@ -147,6 +147,16 @@ struct local_info
bool jumps_threaded;
};
+/* Jump threading statistics. */
+
+struct thread_stats_d
+{
+ unsigned long num_threaded_edges;
+};
+
+struct thread_stats_d thread_stats;
+
+
/* Remove the last statement in block BB if it is a control statement
Also remove all outgoing edges except the edge which reaches DEST_BB.
If DEST_BB is NULL, then remove all outgoing edges. */
@@ -589,6 +599,8 @@ redirect_edges (void **slot, void *data)
to clear it will cause all kinds of unpleasant problems later. */
e->aux = NULL;
+ thread_stats.num_threaded_edges++;
+
if (rd->dup_block)
{
edge e2;
@@ -811,6 +823,7 @@ thread_through_all_blocks (bitmap thread
bitmap_iterator bi;
rediscover_loops_after_threading = false;
+ memset (&thread_stats, 0, sizeof (thread_stats));
EXECUTE_IF_SET_IN_BITMAP (threaded_blocks, 0, i, bi)
{
@@ -820,5 +833,9 @@ thread_through_all_blocks (bitmap thread
retval |= thread_block (bb);
}
+ if (dump_file && (dump_flags & TDF_STATS))
+ fprintf (dump_file, "\nJumps threaded: %lu\n",
+ thread_stats.num_threaded_edges);
+
return retval;
}