Issue 177825
Summary mlir-opt --convert-arith-to-emitc crashes on vector.mask with constant mask
Labels new issue
Assignees
Reporter Subway2023
    # Description
mlir-opt version:   21.1.8 and 22.1.0-rc1

Running mlir-opt with the --convert-arith-to-emitc pass on a module containing a vector.mask operation with a constant mask triggers a crash in the fold hook

This bug causes mlir-opt to crash on version 21.1.8 and to hang on 22.1.0-rc1, preventing compilation from completing.

# Reproduce
location: If the **vector.mask** is commented out, the crash no longer occurs.
```
module {
  func.func @main() {
    %0 = arith.constant 10 : i32
    %1 = vector.vscale
    %2 = vector.constant_mask [10, 8] : vector<16x8xi1>
    vector.mask %2 { vector.yield } : vector<16x8xi1>
 vector.print %0 : i32
    return
  }
}
```
```
mlir-opt --convert-arith-to-emitc test.mlir
```
```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /mnt/sdd1/sbw/mlir/tool/llvm-project-llvmorg-21.1.8-install/bin/mlir-opt --convert-arith-to-emitc /mnt/sdd1/sbw/mlir/data/genProgram_1224/250219_e9c4/mlir_steps/250219_e9c4_4.mlir
 #0 0x0000602f99e5b612 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/mnt/sdd1/sbw/mlir/tool/llvm-project-llvmorg-21.1.8-install/bin/mlir-opt+0x20a1612)
 #1 0x0000602f99e57d7f llvm::sys::RunSignalHandlers() (/mnt/sdd1/sbw/mlir/tool/llvm-project-llvmorg-21.1.8-install/bin/mlir-opt+0x209dd7f)
 #2 0x0000602f99e57ecc SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
  #3 0x000078a76a645330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
  #4 0x0000602f9cdd37a5 bool llvm::detail::UniqueFunctionBase<bool, mlir::TypeID>::CallImpl<mlir::Op<mlir::vector::ConstantMaskOp, mlir::OpTrait::ZeroRegions, mlir::OpTrait::OneResult, mlir::OpTrait::OneTypedResult<mlir::VectorType>::Impl, mlir::OpTrait::ZeroSuccessors, mlir::OpTrait::ZeroOperands, mlir::OpTrait::OpInvariants, mlir::BytecodeOpInterface::Trait, mlir::ConditionallySpeculatable::Trait, mlir::OpTrait::AlwaysSpeculatableImplTrait, mlir::MemoryEffectOpInterface::Trait>::getHasTraitFn()::'lambda'(mlir::TypeID) const>(void*, mlir::TypeID) (/mnt/sdd1/sbw/mlir/tool/llvm-project-llvmorg-21.1.8-install/bin/mlir-opt+0x50197a5)
 #5 0x0000602f9cdb6639 mlir::RegisteredOperationName::Model<mlir::vector::ConstantMaskOp>::hasTrait(mlir::TypeID) (/mnt/sdd1/sbw/mlir/tool/llvm-project-llvmorg-21.1.8-install/bin/mlir-opt+0x4ffc639)
 #6 0x0000602f9d835a64 mlir::Operation::fold(llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/mnt/sdd1/sbw/mlir/tool/llvm-project-llvmorg-21.1.8-install/bin/mlir-opt+0x5a7ba64)
 #7 0x0000602f9d76b364 mlir::OpBuilder::tryFold(mlir::Operation*, llvm::SmallVectorImpl<mlir::Value>&, llvm::SmallVectorImpl<mlir::Operation*>*) (/mnt/sdd1/sbw/mlir/tool/llvm-project-llvmorg-21.1.8-install/bin/mlir-opt+0x59b1364)
 #8 0x0000602f9d6bb411 (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0
  #9 0x0000602f9d6bb906 (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to