[llvm] [LV] Ignore user-specified interleave count when unsafe. (PR #153009)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 21 05:09:31 PDT 2025
================
@@ -9842,7 +9842,7 @@ bool LoopVectorizePass::processLoop(Loop *L) {
// Get user vectorization factor and interleave count.
ElementCount UserVF = Hints.getWidth();
- unsigned UserIC = Hints.getInterleave();
+ unsigned UserIC = LVL.isSafeForAnyVectorWidth() ? Hints.getInterleave() : 1;
----------------
david-arm wrote:
If the user didn't specify an interleave hint then `Hints.getInterleave()` actually returns 0. If `LVL.isSafeForAnyVectorWidth` returns false and there is no hint you'd be setting UserIC to 1 instead of 0. I wonder if it's better to rewrite this as:
```
unsigned UserIC = Hints.getInterleave();
if (UserIC > 1 && !LVL.isSafeForAnyVectorWidth())
UserIC = 1;
```
https://github.com/llvm/llvm-project/pull/153009
More information about the llvm-commits
mailing list