Issue 173374
Summary mlir-opt crashes in llvm/include/llvm/Support/Casting.h:560
Labels mlir, crash
Assignees
Reporter Emilyaxe
    When running opt on the following IR, mlir-opt crashes. 

version 2c02e4c7909a

test.mlir

```
func.func @add_zero_rank(%arg0: tensor<f32>) -> tensor<f32> {
  %result = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>,
 affine_map<(d0) -> (d0)>],
                           iterator_types = ["parallel"]}
                         ins(%arg0 : tensor<f32>)
 outs(%arg0 : tensor<f32>) {
    ^bb0(%3: f32, %x: f32):
 %4 = arith.addf %3, %x : f32
      linalg.yield %4 : f32
  } -> tensor<f32>
  return %result : tensor<f32>
}
```


commads:

mlir-opt test.mlir

stacktrace

```
mlir-opt: llvm-project/llvm/include/llvm/Support/Casting.h:560: decltype(auto) llvm::cast(const From &) [To = mlir::AffineConstantExpr, From = mlir::AffineExpr]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' 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: ./bin/mlir-opt test.mlir
 #0 0x0000562dff43d358 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./bin/mlir-opt+0x1e97358)
 #1 0x0000562dff43aa15 llvm::sys::RunSignalHandlers() (./bin/mlir-opt+0x1e94a15)
 #2 0x0000562dff43e396 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007f1c58bff420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f1c5825800b raise /build/glibc-B3wQXB/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007f1c58237859 abort /build/glibc-B3wQXB/glibc-2.31/stdlib/abort.c:81:7
 #6 0x00007f1c58237729 get_sysdep_segment_value /build/glibc-B3wQXB/glibc-2.31/intl/loadmsgcat.c:509:8
 #7 0x00007f1c58237729 _nl_load_domain /build/glibc-B3wQXB/glibc-2.31/intl/loadmsgcat.c:970:34
 #8 0x00007f1c58248fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #9 0x0000562e07ced99f mlir::AffineMap::compose(llvm::ArrayRef<long>) const (./bin/mlir-opt+0xa74799f)
#10 0x0000562e05c85720 mlir::detail::IndexingMapOpInterfaceTrait<mlir::linalg::GenericOp>::getStaticLoopRanges() (./bin/mlir-opt+0x86df720)
#11 0x0000562e06350078 mlir::detail::IndexingMapOpInterfaceInterfaceTraits::Model<mlir::linalg::GenericOp>::getStaticLoopRanges(mlir::detail::IndexingMapOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*) (./bin/mlir-opt+0x8daa078)
#12 0x0000562e06928737 mlir::IndexingMapOpInterface::verifyImpl() (./bin/mlir-opt+0x9382737)
#13 0x0000562e0604866e mlir::linalg::detail::verifyStructuredOpInterface(mlir::Operation*) (./bin/mlir-opt+0x8aa266e)
#14 0x0000562e06355688 mlir::Op<mlir::linalg::GenericOp, mlir::OpTrait::OneRegion, mlir::OpTrait::VariadicResults, mlir::OpTrait::ZeroSuccessors, mlir::OpTrait::VariadicOperands, mlir::OpTrait::SingleBlock, mlir::OpTrait::SingleBlockImplicitTerminator<mlir::linalg::YieldOp>::Impl, mlir::OpTrait::AttrSizedOperandSegments, mlir::OpTrait::OpInvariants, mlir::BytecodeOpInterface::Trait, mlir::MemoryEffectOpInterface::Trait, mlir::ConditionallySpeculatable::Trait, mlir::OpTrait::HasRecursiveMemoryEffects, mlir::DestinationStyleOpInterface::Trait, mlir::IndexingMapOpInterface::Trait, mlir::linalg::LinalgOp::Trait, mlir::ReifyRankedShapedTypeOpInterface::Trait, mlir::OpAsmOpInterface::Trait>::verifyRegionInvariants(mlir::Operation*) (./bin/mlir-opt+0x8daf688)
#15 0x0000562e0634eb2e mlir::RegisteredOperationName::Model<mlir::linalg::GenericOp>::verifyRegionInvariants(mlir::Operation*) (./bin/mlir-opt+0x8da8b2e)
#16 0x0000562e07e01af1 (anonymous namespace)::OperationVerifier::verifyOpAndDominance(mlir::Operation&) Verifier.cpp:0:0
#17 0x0000562e07e01c50 (anonymous namespace)::OperationVerifier::verifyOpAndDominance(mlir::Operation&) Verifier.cpp:0:0
#18 0x0000562e07e01146 mlir::verify(mlir::Operation*, bool) (./bin/mlir-opt+0xa85b146)
#19 0x0000562e064a1df5 mlir::parseAsmSourceFile(llvm::SourceMgr const&, mlir::Block*, mlir::ParserConfig const&, mlir::AsmParserState*, mlir::AsmParserCodeCompleteContext*) (./bin/mlir-opt+0x8efbdf5)
#20 0x0000562e064864d3 mlir::parseSourceFile(std::shared_ptr<llvm::SourceMgr> const&, mlir::Block*, mlir::ParserConfig const&, mlir::LocationAttr*) (./bin/mlir-opt+0x8ee04d3)
#21 0x0000562dff4e1afe mlir::parseSourceFileForTool(std::shared_ptr<llvm::SourceMgr> const&, mlir::ParserConfig const&, bool) (./bin/mlir-opt+0x1f3bafe)
#22 0x0000562dff4e0827 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#23 0x0000562dff4e05a6 llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#24 0x0000562e07e12855 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (./bin/mlir-opt+0xa86c855)
#25 0x0000562dff4d6166 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./bin/mlir-opt+0x1f30166)
#26 0x0000562dff4d64a2 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./bin/mlir-opt+0x1f304a2)
#27 0x0000562dff4d6805 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./bin/mlir-opt+0x1f30805)
#28 0x0000562dff4239b3 main (./bin/mlir-opt+0x1e7d9b3)
#29 0x00007f1c58239083 __libc_start_main /build/glibc-B3wQXB/glibc-2.31/csu/../csu/libc-start.c:342:3
#30 0x0000562dff4234ee _start (./bin/mlir-opt+0x1e7d4ee)
```

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

Reply via email to