From 86deadf8d3ac55b3cd07e15d4e83e3b6ccd9ee81 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Mon, 2 Nov 2020 15:43:28 +0100 Subject: [PATCH] ipa-cp: New debug counters for IPA-CP MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Martin Liška has been asking me to add debug counters to the IPA-CP pass so that testcase reductions are easier. The pass already has one for the bit value propagation, so this patch adds one for value_range propagation and one for the actual constant propagation. gcc/ChangeLog: 2020-10-30 Martin Jambor * dbgcnt.def (ipa_cp_values): New counter. (ipa_cp_vr): Likewise. * ipa-cp.c (decide_about_value): Check and bump ipa_cp_values debug counter. (decide_whether_version_node): Likewise. (ipcp_store_vr_results):Check and bump ipa_cp_vr debug counter. --- gcc/dbgcnt.def | 2 ++ gcc/ipa-cp.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def index 07946a85ecc..a5b6bb66a6c 100644 --- a/gcc/dbgcnt.def +++ b/gcc/dbgcnt.def @@ -171,6 +171,8 @@ DEBUG_COUNTER (if_after_reload) DEBUG_COUNTER (if_conversion) DEBUG_COUNTER (if_conversion_tree) DEBUG_COUNTER (ipa_cp_bits) +DEBUG_COUNTER (ipa_cp_values) +DEBUG_COUNTER (ipa_cp_vr) DEBUG_COUNTER (ipa_mod_ref) DEBUG_COUNTER (ipa_sra_params) DEBUG_COUNTER (ipa_sra_retvalues) diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 140515668a6..465b072d88d 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -5469,6 +5469,9 @@ decide_about_value (struct cgraph_node *node, int index, HOST_WIDE_INT offset, &caller_count)) return false; + if (!dbg_cnt (ipa_cp_values)) + return false; + if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, " - considering value "); @@ -5584,6 +5587,12 @@ decide_whether_version_node (struct cgraph_node *node) if (info->do_clone_for_all_contexts) { + if (!dbg_cnt (ipa_cp_values)) + { + info->do_clone_for_all_contexts = false; + return ret; + } + struct cgraph_node *clone; vec callers = node->collect_callers (); @@ -5871,7 +5880,8 @@ ipcp_store_vr_results (void) ipa_vr vr; if (!plats->m_value_range.bottom_p () - && !plats->m_value_range.top_p ()) + && !plats->m_value_range.top_p () + && dbg_cnt (ipa_cp_vr)) { vr.known = true; vr.type = plats->m_value_range.m_vr.kind (); -- 2.30.2