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

version 2c02e4c7909a

test.mlir

```
func.func @trs(%idx1: index, %idx2: index, %s: f32) {
  scf.parallel (%i) = (%idx1) to (%idx2) step (%idx2) {
    %r = memref.alloca() : memref<10xf32>
    scf.forall (%e2) in (%idx2) {
      %a = memref.load %r[%idx2] : memref<10xf32>
    }
  }
 return
}

```


commads:

mlir-opt -remove-dead-values test.mlir

stacktrace

```
mlir-opt: llvm-project/llvm/include/llvm/Support/Casting.h:572: decltype(auto) llvm::cast(From *) [To = mlir::RegionBranchTerminatorOpInterface, From = mlir::Operation]: 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 -remove-dead-values test.mlir
 #0 0x0000564286a7f358 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./bin/mlir-opt+0x1e97358)
 #1 0x0000564286a7ca15 llvm::sys::RunSignalHandlers() (./bin/mlir-opt+0x1e94a15)
 #2 0x0000564286a80396 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007f614a91c420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f6149f7500b raise /build/glibc-B3wQXB/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007f6149f54859 abort /build/glibc-B3wQXB/glibc-2.31/stdlib/abort.c:81:7
 #6 0x00007f6149f54729 get_sysdep_segment_value /build/glibc-B3wQXB/glibc-2.31/intl/loadmsgcat.c:509:8
 #7 0x00007f6149f54729 _nl_load_domain /build/glibc-B3wQXB/glibc-2.31/intl/loadmsgcat.c:970:34
 #8 0x00007f6149f65fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #9 0x000056428f0623ef (anonymous namespace)::processRegionBranchOp(mlir::RegionBranchOpInterface, mlir::dataflow::RunLivenessAnalysis&, llvm::DenseSet<mlir::Value, llvm::DenseMapInfo<mlir::Value, void>>&, (anonymous namespace)::RDVFinalCleanupList&) RemoveDeadValues.cpp:0:0
#10 0x0000564286b3550e void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./bin/mlir-opt+0x1f4d50e)
#11 0x0000564286b3550e void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./bin/mlir-opt+0x1f4d50e)
#12 0x0000564286b3550e void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./bin/mlir-opt+0x1f4d50e)
#13 0x000056428f056991 (anonymous namespace)::RemoveDeadValues::runOnOperation() RemoveDeadValues.cpp:0:0
#14 0x000056428f1397be mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./bin/mlir-opt+0xa5517be)
#15 0x000056428f13a617 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./bin/mlir-opt+0xa552617)
#16 0x000056428f1419ca mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (./bin/mlir-opt+0xa5599ca)
#17 0x000056428f14101f mlir::PassManager::run(mlir::Operation*) (./bin/mlir-opt+0xa55901f)
#18 0x0000564286b23377 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#19 0x0000564286b225a6 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
#20 0x000056428f454855 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)
#21 0x0000564286b18166 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./bin/mlir-opt+0x1f30166)
#22 0x0000564286b184a2 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./bin/mlir-opt+0x1f304a2)
#23 0x0000564286b18805 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./bin/mlir-opt+0x1f30805)
#24 0x0000564286a659b3 main (./bin/mlir-opt+0x1e7d9b3)
#25 0x00007f6149f56083 __libc_start_main /build/glibc-B3wQXB/glibc-2.31/csu/../csu/libc-start.c:342:3
#26 0x0000564286a654ee _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