aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-08-23 14:15:14 +0200
committerRichard Biener <rguenther@suse.de>2021-08-24 10:43:10 +0200
commit8571ff0ae0922bee292161c7fd61dd127d26a4ed (patch)
tree25c1e6eb9607cdee669da09dc52235477056c557 /gcc/tree-vect-loop.c
parent0deabebedd16c9519bfb1dfbff303c2d9bd701ee (diff)
downloadgcc-8571ff0ae0922bee292161c7fd61dd127d26a4ed.zip
gcc-8571ff0ae0922bee292161c7fd61dd127d26a4ed.tar.gz
gcc-8571ff0ae0922bee292161c7fd61dd127d26a4ed.tar.bz2
Adjust inner loop cost scaling
This makes use of the estimated number of iterations of the inner loop to limit --param vect-inner-loop-cost-factor scaling. It also reduces the maximum value of vect-inner-loop-cost-factor to 10000 making it less likely to cause overflow of costs. 2021-08-23 Richard Biener <rguenther@suse.de> * doc/invoke.texi (vect-inner-loop-cost-factor): Adjust. * params.opt (--param vect-inner-loop-cost-factor): Adjust maximum value. * tree-vect-loop.c (vect_analyze_loop_form): Initialize inner_loop_cost_factor to the minimum of the estimated number of iterations of the inner loop and vect-inner-loop-cost-factor.
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r--gcc/tree-vect-loop.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index c521b43a..0c8d992 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -1519,6 +1519,13 @@ vect_analyze_loop_form (class loop *loop, vec_info_shared *shared)
stmt_vec_info inner_loop_cond_info
= loop_vinfo->lookup_stmt (inner_loop_cond);
STMT_VINFO_TYPE (inner_loop_cond_info) = loop_exit_ctrl_vec_info_type;
+ /* If we have an estimate on the number of iterations of the inner
+ loop use that to limit the scale for costing, otherwise use
+ --param vect-inner-loop-cost-factor literally. */
+ widest_int nit;
+ if (estimated_stmt_executions (loop->inner, &nit))
+ LOOP_VINFO_INNER_LOOP_COST_FACTOR (loop_vinfo)
+ = wi::smin (nit, param_vect_inner_loop_cost_factor).to_uhwi ();
}
gcc_assert (!loop->aux);