aboutsummaryrefslogtreecommitdiff
path: root/gcc/params.opt
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2020-03-21 00:21:02 +0100
committerMartin Jambor <mjambor@suse.cz>2020-03-21 00:21:02 +0100
commit29f23ed79b60949fc60f6fdbbd931bd58090b241 (patch)
tree2d50bd30c920febc2b540dfca18e3dbce4189055 /gcc/params.opt
parentcc3afc9db0710fe40e3d9a5e941e5e4efe7227f2 (diff)
downloadgcc-29f23ed79b60949fc60f6fdbbd931bd58090b241.zip
gcc-29f23ed79b60949fc60f6fdbbd931bd58090b241.tar.gz
gcc-29f23ed79b60949fc60f6fdbbd931bd58090b241.tar.bz2
sra: Cap number of sub-access propagations with a param (PR 93435)
PR 93435 is a perfect SRA bomb. It initializes an array of 16 chars element-wise, then uses that to initialize an aggregate that consists of four such arrays, that one to initialize one four times as big as the previous one all the way to an aggregate that has 64kb. This causes the sub-access propagation across assignments to create thousands of byte-sized artificial accesses which are then eligible to be replaced - they do facilitate forward propagation but there is enough of them for DSE to never finish. This patch avoids that situation by accounting how many of such replacements can be created per SRA candidate. The default value of 32 was just the largest power of two that did not slow down compilation of the testcase, but it should also hopefully be big enough for any reasonable input that might rely on the optimization. 2020-03-20 Martin Jambor <mjambor@suse.cz> PR tree-optimization/93435 * params.opt (sra-max-propagations): New parameter. * tree-sra.c (propagation_budget): New variable. (budget_for_propagation_access): New function. (propagate_subaccesses_from_rhs): Use it. (propagate_subaccesses_from_lhs): Likewise. (propagate_all_subaccesses): Set up and destroy propagation_budget. gcc/testsuite/ * gcc.dg/tree-ssa/pr93435.c: New test.
Diffstat (limited to 'gcc/params.opt')
-rw-r--r--gcc/params.opt4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/params.opt b/gcc/params.opt
index e39216a..1e484c3 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -844,6 +844,10 @@ Maximum size, in storage units, of an aggregate which should be considered for s
Common Joined UInteger Var(param_sra_max_scalarization_size_speed) Param Optimization
Maximum size, in storage units, of an aggregate which should be considered for scalarization when compiling for speed.
+-param=sra-max-propagations=
+Common Joined UInteger Var(param_sra_max_propagations) Param Optimization Init(32)
+Maximum number of artificial accesses to enable forward propagation that Scalar Replacement of Aggregates will keep for one local variable.
+
-param=ssa-name-def-chain-limit=
Common Joined UInteger Var(param_ssa_name_def_chain_limit) Init(512) Param Optimization
The maximum number of SSA_NAME assignments to follow in determining a value.