aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop-manip.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-11-13 09:05:59 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-11-13 09:05:59 +0000
commit6eed64b96d886da2518d86eae5bc0a5ed66cabe0 (patch)
tree37497aa97fda968edca614ae83fa11d8b58c66d0 /gcc/tree-vect-loop-manip.c
parentd4b44b834e3ac1b92ffb165e7bdaf641a211c34b (diff)
downloadgcc-6eed64b96d886da2518d86eae5bc0a5ed66cabe0.zip
gcc-6eed64b96d886da2518d86eae5bc0a5ed66cabe0.tar.gz
gcc-6eed64b96d886da2518d86eae5bc0a5ed66cabe0.tar.bz2
Avoid accounting for non-existent vector loop versioning
vect_analyze_loop_costing uses two profitability thresholds: a runtime one and a static compile-time one. The runtime one is simply the point at which the vector loop is cheaper than the scalar loop, while the static one also takes into account the cost of choosing between the scalar and vector loops at runtime. We compare this static cost against the expected execution frequency to decide whether it's worth generating any vector code at all. However, we never reclaimed the cost of applying the runtime threshold if it turned out that the vector code can always be used. And we only know whether that's true once we've calculated what the runtime threshold would be. 2019-11-13 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree-vectorizer.h (vect_apply_runtime_profitability_check_p): New function. * tree-vect-loop-manip.c (vect_loop_versioning): Use it. * tree-vect-loop.c (vect_analyze_loop_2): Likewise. (vect_transform_loop): Likewise. (vect_analyze_loop_costing): Don't take the cost of versioning into account for the static profitability threshold if it turns out that no versioning is needed. From-SVN: r278124
Diffstat (limited to 'gcc/tree-vect-loop-manip.c')
-rw-r--r--gcc/tree-vect-loop-manip.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 559d59b..beee5fe 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -3171,8 +3171,7 @@ vect_loop_versioning (loop_vec_info loop_vinfo)
= LOOP_REQUIRES_VERSIONING_FOR_SIMD_IF_COND (loop_vinfo);
unsigned th = LOOP_VINFO_COST_MODEL_THRESHOLD (loop_vinfo);
- if (th >= vect_vf_for_cost (loop_vinfo)
- && !LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
+ if (vect_apply_runtime_profitability_check_p (loop_vinfo)
&& !ordered_p (th, versioning_threshold))
cond_expr = fold_build2 (GE_EXPR, boolean_type_node, scalar_loop_iters,
build_int_cst (TREE_TYPE (scalar_loop_iters),