aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-11-21 09:50:54 +0100
committerRichard Biener <rguenther@suse.de>2023-11-21 15:31:56 +0100
commitae156936cf4f15d9cc2b7d4e39f2e6b8fe22a9c3 (patch)
tree09a865a5620bc852c66c01f522949b2173669930 /gcc/tree-vect-loop.cc
parent1d82fc2e6824bf83159389729c31a942f7b91b04 (diff)
downloadgcc-ae156936cf4f15d9cc2b7d4e39f2e6b8fe22a9c3.zip
gcc-ae156936cf4f15d9cc2b7d4e39f2e6b8fe22a9c3.tar.gz
gcc-ae156936cf4f15d9cc2b7d4e39f2e6b8fe22a9c3.tar.bz2
Move VF based dependence check
The following moves the check whether the maximum vectorization factor determined by data dependence analysis is in conflict with the chosen vectorization factor to after the point where we applied both the SLP and the unrolling adjustment to the vectorization factor. We check the latter before applying unrolling, but the SLP adjustment can result in both missed optimization and wrong-code. * tree-vect-loop.cc (vect_analyze_loop_2): Move check of VF against max_vf until VF is final.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
-rw-r--r--gcc/tree-vect-loop.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 58679e91..a73a533 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -2817,9 +2817,6 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal,
"can't determine vectorization factor.\n");
return ok;
}
- if (max_vf != MAX_VECTORIZATION_FACTOR
- && maybe_lt (max_vf, LOOP_VINFO_VECT_FACTOR (loop_vinfo)))
- return opt_result::failure_at (vect_location, "bad data dependence.\n");
/* Compute the scalar iteration cost. */
vect_compute_single_scalar_iteration_cost (loop_vinfo);
@@ -2881,6 +2878,10 @@ start_over:
LOOP_VINFO_INT_NITERS (loop_vinfo));
}
+ if (max_vf != MAX_VECTORIZATION_FACTOR
+ && maybe_lt (max_vf, LOOP_VINFO_VECT_FACTOR (loop_vinfo)))
+ return opt_result::failure_at (vect_location, "bad data dependence.\n");
+
loop_vinfo->vector_costs = init_cost (loop_vinfo, false);
/* Analyze the alignment of the data-refs in the loop.