This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
dbg count support for ccp
- From: Xinliang David Li <davidxl at google dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Cc: Diego Novillo <dnovillo at google dot com>
- Date: Fri, 27 Mar 2009 16:14:46 -0700
- Subject: dbg count support for ccp
Hi, the following patch is to add debug count support in the CCP pass.
This can be used to triage runtime problem due to bug in ccp or
triggered by CCP.
Bootstrapped/Tested on linux/i686.
Ok for mainline ?
Thanks,
David
Index: dbgcnt.def
===================================================================
--- dbgcnt.def (revision 145121)
+++ dbgcnt.def (working copy)
@@ -142,6 +142,7 @@ echo ubound: $ub
/* Debug counter definitions. */
DEBUG_COUNTER (auto_inc_dec)
+DEBUG_COUNTER (ccp)
DEBUG_COUNTER (cfg_cleanup)
DEBUG_COUNTER (cse2_move2add)
DEBUG_COUNTER (cprop1)
Index: tree-ssa-ccp.c
===================================================================
--- tree-ssa-ccp.c (revision 145121)
+++ tree-ssa-ccp.c (working copy)
@@ -208,6 +208,7 @@ along with GCC; see the file COPYING3.
#include "langhooks.h"
#include "target.h"
#include "toplev.h"
+#include "dbgcnt.h"
/* Possible lattice values. */
@@ -685,6 +686,24 @@ ccp_initialize (void)
}
}
+/* Debug count support. Reset the values of ssa names
+ VARYING when the total number ssa names analyzed is
+ beyond the debug count specified. */
+
+static void
+do_dbg_cnt (void)
+{
+ unsigned i;
+ for (i = 0; i < num_ssa_names; i++)
+ {
+ if (!dbg_cnt (ccp))
+ {
+ const_val[i].lattice_val = VARYING;
+ const_val[i].value = NULL_TREE;
+ }
+ }
+}
+
/* Do final substitution of propagated values, cleanup the flowgraph and
free allocated storage.
@@ -694,8 +713,11 @@ ccp_initialize (void)
static bool
ccp_finalize (void)
{
+ bool something_changed;
+
+ do_dbg_cnt ();
/* Perform substitutions based on the known constant values. */
- bool something_changed = substitute_and_fold (const_val, false);
+ something_changed = substitute_and_fold (const_val, false);
free (const_val);
const_val = NULL;