![]() In the following loop the dependence distance is 2 and can only be vectorized if the vector length is no larger than this. void foo(int *a, int *b, int N) { #pragma clang loop vectorize(enable) vectorize_width(4) for (int i=0; i<N; ++i) { a[i + 2] = a[i] + b[i]; } } However, when specifying a VF of 4 via a loop hint this loop is vectorized. According to [1][2], loop hints are ignored if the optimization is not safe to apply. This patch introduces a check to bail of vectorization if the user specified VF is greater than the maximum feasible VF, unless explicitly forced with '-force-vector-width=X'. [1] https://llvm.org/docs/LangRef.html#llvm-loop-vectorize-and-llvm-loop-interleave [2] https://clang.llvm.org/docs/LanguageExtensions.html#extensions-for-loop-hint-optimizations Reviewed By: sdesmalen, fhahn, Meinersbur Differential Revision: https://reviews.llvm.org/D90687 |
||
---|---|---|
.. | ||
Oz-and-forced-vectorize.ll | ||
aarch64-predication.ll | ||
aarch64-unroll.ll | ||
arbitrary-induction-step.ll | ||
arm64-unroll.ll | ||
backedge-overflow.ll | ||
deterministic-type-shrinkage.ll | ||
extractvalue-no-scalarization-required.ll | ||
gather-cost.ll | ||
induction-trunc.ll | ||
interleaved-vs-scalar.ll | ||
interleaved_cost.ll | ||
lit.local.cfg | ||
loop-vectorization-factors.ll | ||
loopvectorize_pr33804_double.ll | ||
max-vf-for-interleaved.ll | ||
no_vector_instructions.ll | ||
nontemporal-load-store.ll | ||
outer_loop_test1_no_explicit_vect_width.ll | ||
pr31900.ll | ||
pr33053.ll | ||
pr36032.ll | ||
pr46950-load-cast-context-crash.ll | ||
predication_costs.ll | ||
reduction-small-size.ll | ||
sdiv-pow2.ll | ||
select-costs.ll | ||
smallest-and-widest-types.ll | ||
sve-scalable-load-in-loop.ll | ||
type-shrinkage-insertelt.ll | ||
unsafe-vf-hint-remark.ll |