Issue |
128318
|
Summary |
[MLIR]`-remove-dead-values` triggers Assertion Failure `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"'
|
Labels |
mlir
|
Assignees |
|
Reporter |
xisang0
|
Test on commit: https://github.com/llvm/llvm-project/commit/a9882bda96228ca23e166a817f93a7dbc99763cb
steps to reproduce:
```
mlir-opt test.mlir -remove-dead-values
```
test case:
```
module {
func.func @parallel_region() -> () {
%alloc0 = bufferization.alloc_tensor() : tensor<320xf32>
%alloc1 = bufferization.alloc_tensor() : tensor<1xf32>
%c320 = arith.constant 320 : index
%0 = scf.forall (%arg0) in (%c320) shared_outs(%arg1 = %alloc0) -> (tensor<320xf32>) {
%val = "test.foo"() : () -> (f32)
}
return
}
}
```
crash trace:
```
mlir-opt: /home/workdir/llvm-project-19/llvm/include/llvm/Support/Casting.h:578: 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.
Stack dump:
0. Program arguments: ./mlir-opt /home/workdir/test.mlir -remove-dead-values
#0 0x0000563423da5998 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x108a998)
#1 0x0000563423da34be llvm::sys::RunSignalHandlers() (./mlir-opt+0x10884be)
#2 0x0000563423da63a8 SignalHandler(int) Signals.cpp:0:0
#3 0x000075c340961520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000075c3409b59fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000075c340961476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000075c3409477f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000075c34094771b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x000075c340958e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x00005634270af84d (anonymous namespace)::cleanRegionBranchOp(mlir::RegionBranchOpInterface, mlir::dataflow::RunLivenessAnalysis&)::$_3::operator()(mlir::RegionSuccessor const&, mlir::Operation*) const RemoveDeadValues.cpp:0:0
#10 0x00005634270abfca (anonymous namespace)::cleanRegionBranchOp(mlir::RegionBranchOpInterface, mlir::dataflow::RunLivenessAnalysis&) RemoveDeadValues.cpp:0:0
#11 0x0000563423eb78de void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x119c8de)
#12 0x0000563423eb78de void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x119c8de)
#13 0x00005634270aa065 (anonymous namespace)::RemoveDeadValues::runOnOperation() RemoveDeadValues.cpp:0:0
#14 0x00005634270763bf mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x435b3bf)
#15 0x0000563427076ba2 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x435bba2)
#16 0x000056342707934e mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x435e34e)
#17 0x0000563427071e6b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#18 0x0000563427071acb llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, 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::raw_ostream&) MlirOptMain.cpp:0:0
#19 0x000056342711adf5 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::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (./mlir-opt+0x43ffdf5)
#20 0x000056342706c9b2 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x43519b2)
#21 0x000056342706cc63 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x4351c63)
#22 0x000056342706ce72 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x4351e72)
#23 0x0000563423d84c27 main (./mlir-opt+0x1069c27)
#24 0x000075c340948d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#25 0x000075c340948e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#26 0x0000563423d84795 _start (./mlir-opt+0x1069795)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs