[llvm-branch-commits] [llvm] [LV] -scalable-vectorization=preferred should not override UserVF=1 (PR #226948)
Gaëtan Bossu via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Sep 29 03:30:52 PDT 2026
================
@@ -132,8 +132,11 @@ LoopVectorizeHints::LoopVectorizeHints(const Loop *L,
// If the flag is set to force any use of scalable vectors, override the loop
// hints.
- if (ForceScalableVectorization.getValue() !=
- LoopVectorizeHints::SK_Unspecified)
+ // However: A preference must not turn a UserVF of 1, used by e.g.
+ // vectorize(disable) pragmas, into a vscale x 1 VF.
+ if (ForceScalableVectorization.getValue() != SK_Unspecified &&
+ (Width.Value != 1 ||
----------------
gbossu wrote:
I've updated the PR to better document how `scalable` is really chosen based on all the hints/options LV gets.
Your point makes sense to me and that why I initially restricted (first commit) the change to `-scalable-vectorization=preferred` and `UserVF=1`. I thought that having the pragma take precedence over `-scalable-vectorization` would the the right choice because it's consistent with the other choices made for Width and IC. Now that I've looked at those choices in more detail, I'm not so sure what the "consistent rule" is. 😃
https://github.com/llvm/llvm-project/pull/226948
More information about the llvm-branch-commits
mailing list