diff options
author | Richard Biener <rguenther@suse.de> | 2023-09-20 08:40:34 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-09-20 11:20:24 +0200 |
commit | b8a2a12464d25c45a51c14a025e8e2d3ca8ebeb0 (patch) | |
tree | 624fd91c9062420e7ade7e656eb677d36d5763d6 /gcc/gimple-predicate-analysis.cc | |
parent | 47ecac52bd4cae84dc786731c655c3bfe1ade377 (diff) | |
download | gcc-b8a2a12464d25c45a51c14a025e8e2d3ca8ebeb0.zip gcc-b8a2a12464d25c45a51c14a025e8e2d3ca8ebeb0.tar.gz gcc-b8a2a12464d25c45a51c14a025e8e2d3ca8ebeb0.tar.bz2 |
tree-optimization/111489 - turn uninit limits to params
The following turns MAX_NUM_CHAINS and MAX_CHAIN_LEN to params which
allows to experiment with raising them. For the testcase in PR111489
raising MAX_CHAIN_LEN from 5 to 8 avoids the bogus diagnostics
at -O2, at -O3 we need a MAX_CHAIN_LEN of 6.
PR tree-optimization/111489
* doc/invoke.texi (--param uninit-max-chain-len): Document.
(--param uninit-max-num-chains): Likewise.
* params.opt (-param=uninit-max-chain-len=): New.
(-param=uninit-max-num-chains=): Likewise.
* gimple-predicate-analysis.cc (MAX_NUM_CHAINS): Define to
param_uninit_max_num_chains.
(MAX_CHAIN_LEN): Define to param_uninit_max_chain_len.
(uninit_analysis::init_use_preds): Avoid VLA.
(uninit_analysis::init_from_phi_def): Likewise.
(compute_control_dep_chain): Avoid using MAX_CHAIN_LEN in
template parameter.
Diffstat (limited to 'gcc/gimple-predicate-analysis.cc')
-rw-r--r-- | gcc/gimple-predicate-analysis.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/gimple-predicate-analysis.cc b/gcc/gimple-predicate-analysis.cc index 373163b..ad2c355 100644 --- a/gcc/gimple-predicate-analysis.cc +++ b/gcc/gimple-predicate-analysis.cc @@ -50,8 +50,8 @@ /* In our predicate normal form we have MAX_NUM_CHAINS or predicates and in those MAX_CHAIN_LEN (inverted) and predicates. */ -#define MAX_NUM_CHAINS 8 -#define MAX_CHAIN_LEN 5 +#define MAX_NUM_CHAINS (unsigned)param_uninit_max_num_chains +#define MAX_CHAIN_LEN (unsigned)param_uninit_max_chain_len /* Return true if X1 is the negation of X2. */ @@ -1163,11 +1163,12 @@ compute_control_dep_chain (basic_block dom_bb, const_basic_block dep_bb, vec<edge> cd_chains[], unsigned *num_chains, unsigned in_region = 0) { - auto_vec<edge, MAX_CHAIN_LEN + 1> cur_cd_chain; + auto_vec<edge, 10> cur_cd_chain; unsigned num_calls = 0; unsigned depth = 0; bool complete_p = true; /* Walk the post-dominator chain. */ + cur_cd_chain.reserve (MAX_CHAIN_LEN + 1); compute_control_dep_chain_pdom (dom_bb, dep_bb, NULL, cd_chains, num_chains, cur_cd_chain, &num_calls, in_region, depth, &complete_p); @@ -2035,7 +2036,7 @@ uninit_analysis::init_use_preds (predicate &use_preds, basic_block def_bb, are logical conjunctions. Together, the DEP_CHAINS vector is used below to initialize an OR expression of the conjunctions. */ unsigned num_chains = 0; - auto_vec<edge> dep_chains[MAX_NUM_CHAINS]; + auto_vec<edge> *dep_chains = new auto_vec<edge>[MAX_NUM_CHAINS]; if (!dfs_mark_dominating_region (use_bb, cd_root, in_region, region) || !compute_control_dep_chain (cd_root, use_bb, dep_chains, &num_chains, @@ -2060,6 +2061,7 @@ uninit_analysis::init_use_preds (predicate &use_preds, basic_block def_bb, Each OR subexpression is represented by one element of DEP_CHAINS, where each element consists of a series of AND subexpressions. */ use_preds.init_from_control_deps (dep_chains, num_chains, true); + delete[] dep_chains; return !use_preds.is_empty (); } @@ -2144,7 +2146,7 @@ uninit_analysis::init_from_phi_def (gphi *phi) break; unsigned num_chains = 0; - auto_vec<edge> dep_chains[MAX_NUM_CHAINS]; + auto_vec<edge> *dep_chains = new auto_vec<edge>[MAX_NUM_CHAINS]; for (unsigned i = 0; i < nedges; i++) { edge e = def_edges[i]; @@ -2175,6 +2177,7 @@ uninit_analysis::init_from_phi_def (gphi *phi) which the PHI operands are defined to values for which M_EVAL is false. */ m_phi_def_preds.init_from_control_deps (dep_chains, num_chains, false); + delete[] dep_chains; return !m_phi_def_preds.is_empty (); } |