From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id 4E0CB385AC1F; Mon, 5 Sep 2022 13:15:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E0CB385AC1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662383725; bh=VHmmiGHYiFmgp60t5ieW9xkbSbCkLQXima+LadL1YVI=; h=From:To:Subject:Date:From; b=yau1B/aWaiB7BpbeqA7KPBPDbhg1tcyox1H1UX5uf9F4PgXLTuLoGkPwvKf7eyw5O 2a4kXlynM2N8ZDqUdKC3vY4XIQOYQ7q2lY01pQoNS5yJ3sGXqBQuoUypMWH2InqkqX jPjH6rPXnq97Jvoo6NFNKoLHO66sXgOvq/yNkr1s= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2436] Unify MAX_POSTDOM_CHECK and --param uninit-control-dep-attempts X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/master X-Git-Oldrev: 5642197cc239942718c95d1f117bc6977cdeec3d X-Git-Newrev: e9ea2688271bd0b4319bdfb1fc852169ab3cf076 Message-Id: <20220905131525.4E0CB385AC1F@sourceware.org> Date: Mon, 5 Sep 2022 13:15:25 +0000 (GMT) List-Id: https://gcc.gnu.org/g:e9ea2688271bd0b4319bdfb1fc852169ab3cf076 commit r13-2436-ge9ea2688271bd0b4319bdfb1fc852169ab3cf076 Author: Richard Biener Date: Mon Sep 5 14:21:01 2022 +0200 Unify MAX_POSTDOM_CHECK and --param uninit-control-dep-attempts The following unifies both limits, in particular the MAX_POSTDOM_CHECK tends to be too low and is not user-controllable. * gimple-predicate-analysis.cc (MAX_POSTDOM_CHECK): Remove. (compute_control_dep_chain): Move uninit-control-dep-attempts checking where it also counts the post-dominator check invocations. Diff: --- gcc/gimple-predicate-analysis.cc | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/gcc/gimple-predicate-analysis.cc b/gcc/gimple-predicate-analysis.cc index 5629a6dc277..6684aa6c179 100644 --- a/gcc/gimple-predicate-analysis.cc +++ b/gcc/gimple-predicate-analysis.cc @@ -52,10 +52,6 @@ #define MAX_NUM_CHAINS 8 #define MAX_CHAIN_LEN 5 -/* When enumerating paths between two blocks this limits the number of - post-dominator skips between two edges possibly defining a predicate. */ -#define MAX_POSTDOM_CHECK 8 - /* The limit for the number of switch cases when we do the linear search for the case corresponding to an edge. */ #define MAX_SWITCH_CASES 40 @@ -1010,15 +1006,6 @@ compute_control_dep_chain (basic_block dom_bb, const_basic_block dep_bb, if (single_succ_p (dom_bb)) return false; - if (*num_calls > (unsigned)param_uninit_control_dep_attempts) - { - if (dump_file) - fprintf (dump_file, "param_uninit_control_dep_attempts exceeded: %u\n", - *num_calls); - return false; - } - ++*num_calls; - /* FIXME: Use a set instead. */ unsigned cur_chain_len = cur_cd_chain.length (); if (cur_chain_len > MAX_CHAIN_LEN) @@ -1048,7 +1035,6 @@ compute_control_dep_chain (basic_block dom_bb, const_basic_block dep_bb, edge_iterator ei; FOR_EACH_EDGE (e, ei, dom_bb->succs) { - int post_dom_check = 0; if (e->flags & (EDGE_FAKE | EDGE_ABNORMAL | EDGE_DFS_BACK)) continue; @@ -1088,6 +1074,17 @@ compute_control_dep_chain (basic_block dom_bb, const_basic_block dep_bb, if (in_region != 0 && !(cd_bb->flags & in_region)) break; + /* Count the number of steps we perform to limit compile-time. + This should cover both recursion and the post-dominator walk. */ + if (*num_calls > (unsigned)param_uninit_control_dep_attempts) + { + if (dump_file) + fprintf (dump_file, "param_uninit_control_dep_attempts " + "exceeded: %u\n", *num_calls); + return false; + } + ++*num_calls; + /* Check if DEP_BB is indirectly control-dependent on DOM_BB. */ if (!single_succ_p (cd_bb) && compute_control_dep_chain (cd_bb, dep_bb, cd_chains, @@ -1105,9 +1102,7 @@ compute_control_dep_chain (basic_block dom_bb, const_basic_block dep_bb, && single_succ_edge (cd_bb)->flags & EDGE_DFS_BACK) break; cd_bb = get_immediate_dominator (CDI_POST_DOMINATORS, cd_bb); - post_dom_check++; - if (cd_bb == EXIT_BLOCK_PTR_FOR_FN (cfun) - || post_dom_check > MAX_POSTDOM_CHECK) + if (cd_bb == EXIT_BLOCK_PTR_FOR_FN (cfun)) break; } cur_cd_chain.pop ();