Issue 177829
Summary mlir-opt --convert-vector-to-llvm crashes on vector.insert with out-of-bounds index
Labels new issue
Assignees
Reporter Subway2023
    # Description
mlir-opt version: 22.1.0-rc1

Running mlir-opt with the --convert-vector-to-llvm pass on a module containing a vector.insert with an index exceeding the outer vector dimension triggers an assertion failure

# Reproduce
location: If **vector.print %2 : vector<2x4xi1>** is commented out, the crash no longer occurs.
```
module {
  func.func @main() {
    %0 = vector.constant_mask [1, 4] : vector<2x4xi1>
    %1 = arith.constant 257 : index
    %iv = vector.extract %0[0] : vector<4xi1> from vector<2x4xi1>
    %2 = vector.insert %iv, %0[%1] : vector<4xi1> into vector<2x4xi1>
 vector.print %0 : vector<2x4xi1>
    vector.print %2 : vector<2x4xi1>
 return
  }
}
```
```
mlir-opt --convert-vector-to-llvm test.mlir
```
```
mlir-opt: /mnt/sdd1/mlir/tool/llvm-project-llvmorg-22.1.0-rc1/mlir/lib/Dialect/Vector/IR/VectorOps.cpp:362: mlir::vector::getAsIntegers(llvm::ArrayRef<mlir::OpFoldResult>)::<lambda(mlir::OpFoldResult)>: Assertion `isa<Attribute>(foldResult) && "Unexpected non-constant index"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.      Program arguments: /mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt --convert-vector-to-llvm /mnt/sdd1/sbw/mlir/data/genProgram_1224/250530_c48d/mlir_steps/250530_c48d_5.mlir
 #0 0x00005de3b6048e32 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x252fe32)
 #1 0x00005de3b60455af llvm::sys::RunSignalHandlers() (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x252c5af)
 #2 0x00005de3b60456fc SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007b8682045330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
 #4 0x00007b868209eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x00007b868209eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x00007b868209eb2c pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x00007b868204527e raise ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x00007b86820288ff abort ./stdlib/abort.c:81:7
 #9 0x00007b868202881b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007b868203b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#11 0x00005de3bc61f7d4 mlir::vector::getAsIntegers(llvm::ArrayRef<mlir::OpFoldResult>) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x8b067d4)
#12 0x00005de3ba364ce6 (anonymous namespace)::VectorInsertOpConversion::matchAndRewrite(mlir::vector::InsertOp, mlir::vector::InsertOpAdaptor, mlir::ConversionPatternRewriter&) const ConvertVectorToLLVM.cpp:0:0
```


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to