| Issue |
239720
|
| Summary |
[mlir][VectorToLLVM] Single-element `vector.load` from a non-unit stride crashes
|
| Labels |
mlir
|
| Assignees |
|
| Reporter |
pingshiyu
|
Reproduced with the optimized assertions-enabled LLVM Git `main` build at commit fb288ec4774f8664b165f6e302db5be8b30a41da from 04/Nov/2026.
```mlir
func.func @test(%m: memref<3x1xi32, strided<[1, 3]>>, %passthru: vector<1xi32>) -> vector<1xi32> {
%c0 = arith.constant 0 : index
%mask = arith.constant dense<true> : vector<1xi1>
%x = vector.expandload %m[%c0, %c0], %mask, %passthru : memref<3x1xi32, strided<[1, 3]>>, vector<1xi1>, vector<1xi32> into vector<1xi32>
return %x : vector<1xi32>
}
```
```console
mlir-opt repro.mlir --canonicalize --convert-vector-to-llvm -o /dev/null
```
Canonicalization aborts on `VectorLoadStoreConversion<vector::LoadOp>` with:
```text
Assertion `(strides.empty() || strides.back() == 1) && "vector.load/store requires unit trailing memref stride"' failed.
```
`canonicalize` folds the all-true `vector.expandload` to a valid `vector.load`. The trailing stride cannot affect a one-element access, so I expected VectorToLLVM either to lower it or to handle the operation without crashing.
## Related cases
[PR #108998](https://github.com/llvm/llvm-project/pull/108998) deliberately permits fixed one-element `vector.load` and `vector.store` operations on non-unit-stride MemRefs because they are equivalent to scalar accesses. This reproducer reaches that supported case after canonicalization.
[PR #202118](https://github.com/llvm/llvm-project/pull/202118) later introduced the unconditional trailing-stride assertion in `VectorLoadStoreConversion`, stating that the verifier guarantees unit stride; that assumption overlooks the one-element exception from #108998. [PR #216485](https://github.com/llvm/llvm-project/pull/216485) subsequently extended the shared stride check to `vector.expandload` and related operations, but the shared verifier retains the same exception, so this input remains valid.
No exact open or closed issue was found. This differs from unsupported non-contiguous multi-lane loads: only one element is accessed, so there is no inter-lane contiguity requirement.
## LLM-Suggested Cause
The VectorToLLVM load/store conversion applies its multi-lane trailing-stride precondition to a one-element vector without a scalar-width exception.
## LLM Declaration
LLM was used to prepare the bug report, and the bug itself was found and verified by a human.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs