<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/71150>71150</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir] --tosa-to-scf --canonicalize crashed with assertion failure "succeeded(ConcreteT::verify(getDefaultDiagnosticEmitFn(ctx), args...))"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
anonymousMCS
</td>
</tr>
</table>
<pre>
git version: a1358225c5b791fa9d901e74fb09606189c0e6af
system: ```Ubuntu 20.04.6 LTS (Focal Fossa)```
reproduced with: ```mlir-opt --tosa-to-scf --canonicalize a.mlir```
a.mlir:
```
func.func private @func2() {
%c11 = arith.constant 11 : index
%c21 = arith.constant 21 : index
%c6 = arith.constant 6 : index
%c27 = arith.constant 27 : index
%c19 = arith.constant 19 : index
%45 = affine.apply affine_map<(d0)[s0] -> (-((d0 mod 4) mod 16 + 4))>(%c21)[%c11]
%c30 = arith.constant 30 : index
%c31 = arith.constant 31 : index
%20 = tensor.empty(%c27, %c6, %c31) : tensor<?x?x?xi1>
%55 = tensor.empty() : tensor<16x2xi32>
%123 = "tosa.bitwise_not"(%20) : (tensor<?x?x?xi1>) -> tensor<?x?x?xi1>
%129 = tensor.empty(%c19, %c27, %45) : tensor<?x?x?xi1>
%130 = "tosa.add"(%123, %129) : (tensor<?x?x?xi1>, tensor<?x?x?xi1>) -> tensor<?x?x?xi1>
%152 = tensor.empty(%c31, %c30, %45) : tensor<?x?x?xi1>
%153 = "tosa.scatter"(%130, %55, %152) : (tensor<?x?x?xi1>, tensor<16x2xi32>, tensor<?x?x?xi1>) -> tensor<?x?x?xi1>
return
}
```
trace:
```
mlir-opt: /data/bin/llvm-project/mlir/include/mlir/IR/StorageUniquerSupport.h:180: static ConcreteT mlir::detail::StorageUserBase<ConcreteT, BaseT, StorageT, UniquerT, Traits>::get(mlir::MLIRContext*, Args&& ...) [with Args = {llvm::ArrayRef<long int>&, mlir::Type&, mlir::Attribute&}; ConcreteT = mlir::RankedTensorType; BaseT = mlir::TensorType; StorageT = mlir::detail::RankedTensorTypeStorage; UniquerT = mlir::detail::TypeUniquer; Traits = {mlir::ShapedType::Trait}]: Assertion `succeeded(ConcreteT::verify(getDefaultDiagnosticEmitFn(ctx), args...))' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /data/bin/llvm-project/build/bin/mlir-opt --tosa-to-scf --canonicalize a.mlir
#0 0x0000564cc8ca38bf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin/llvm-project/build/bin/mlir-opt+0x15db8bf)
#1 0x0000564cc8ca0954 SignalHandler(int) Signals.cpp:0:0
#2 0x00007fb8c0a7f420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007fb8c056a00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007fb8c0549859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x00007fb8c0549729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#6 0x00007fb8c055afd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#7 0x0000564ccb9c009f mlir::RankedTensorType mlir::detail::StorageUserBase<mlir::RankedTensorType, mlir::TensorType, mlir::detail::RankedTensorTypeStorage, mlir::detail::TypeUniquer, mlir::ShapedType::Trait>::get<llvm::ArrayRef<long>&, mlir::Type&, mlir::Attribute&>(mlir::MLIRContext*, llvm::ArrayRef<long>&, mlir::Type&, mlir::Attribute&) (/data/bin/llvm-project/build/bin/mlir-opt+0x42f809f)
#8 0x0000564ccb9c00ed mlir::RankedTensorType::get(llvm::ArrayRef<long>, mlir::Type, mlir::Attribute) (/data/bin/llvm-project/build/bin/mlir-opt+0x42f80ed)
#9 0x0000564cca948c22 mlir::tensor::ExtractSliceOp::inferCanonicalRankReducedResultType(unsigned int, mlir::RankedTensorType, llvm::ArrayRef<long>, llvm::ArrayRef<long>, llvm::ArrayRef<long>) (/data/bin/llvm-project/build/bin/mlir-opt+0x3280c22)
#10 0x0000564cca949043 mlir::tensor::ExtractSliceOp::inferCanonicalRankReducedResultType(unsigned int, mlir::RankedTensorType, llvm::ArrayRef<mlir::OpFoldResult>, llvm::ArrayRef<mlir::OpFoldResult>, llvm::ArrayRef<mlir::OpFoldResult>) (/data/bin/llvm-project/build/bin/mlir-opt+0x3281043)
#11 0x0000564cca97a434 (anonymous namespace)::InsertSliceOpConstantArgumentFolder<mlir::tensor::InsertSliceOp>::matchAndRewrite(mlir::tensor::InsertSliceOp, mlir::PatternRewriter&) const TensorOps.cpp:0:0
#12 0x0000564cc94a09ea mlir::detail::OpOrInterfaceRewritePatternBase<mlir::tensor::InsertSliceOp>::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/data/bin/llvm-project/build/bin/mlir-opt+0x1dd89ea)
#13 0x0000564cce529688 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::Pattern const&)>) (/data/bin/llvm-project/build/bin/mlir-opt+0x6e61688)
#14 0x0000564ccb8d463c (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
#15 0x0000564ccb8d8aab mlir::applyPatternsAndFoldGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/data/bin/llvm-project/build/bin/mlir-opt+0x4210aab)
#16 0x0000564ccb83e17a (anonymous namespace)::Canonicalizer::runOnOperation() Canonicalizer.cpp:0:0
#17 0x0000564ccb81f0ce mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x41570ce)
#18 0x0000564ccb81f5aa mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/bin/llvm-project/build/bin/mlir-opt+0x41575aa)
#19 0x0000564ccb81fdd4 mlir::PassManager::run(mlir::Operation*) (/data/bin/llvm-project/build/bin/mlir-opt+0x4157dd4)
#20 0x0000564ccb810b5b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#21 0x0000564ccb812014 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPool*) MlirOptMain.cpp:0:0
#22 0x0000564ccb8121c4 mlir::LogicalResult llvm::function_ref<mlir::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&)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#23 0x0000564ccb911124 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (/data/bin/llvm-project/build/bin/mlir-opt+0x4249124)
#24 0x0000564ccb80ac77 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/bin/llvm-project/build/bin/mlir-opt+0x4142c77)
#25 0x0000564ccb812311 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x414a311)
#26 0x0000564ccb812776 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x414a776)
#27 0x0000564cc8bdae3b main (/data/bin/llvm-project/build/bin/mlir-opt+0x1512e3b)
#28 0x00007fb8c054b083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#29 0x0000564cc8c73f8e _start (/data/bin/llvm-project/build/bin/mlir-opt+0x15abf8e)
Aborted (core dumped)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWl9z4rqS_zTKiyqULPnvQx4IhN2pmqmkkpzaR0qWZNCOkb2SPBPOp9-SbMB2gDBDzrnn3qkkY-zuVvev_0qGGiNXSog7EN2DaH5DG7uu9B1VldpuqsZ8m73c5BXf3q2khT-ENrJSgEwhDUiUYhyxKE-yoKAZz1AgkrDIURajOEgzhkRMC4DmAE3bv2ZrrNg4bhCj9uePvFG2gRhNUDiJ4dfXFwhwuqgYLeGiMoYCnO2J-7K0qHXFGyY4_CnteiB0U0p9W9UW3t7aytBbW90aVsDbW-bMkoyW8k8B6cTRHRXePSLdxxFN0Sg2cX9greUPagUEIXKfMcApwBkEyX1LCSHAEQsCCMgcUi3tesIqZSxVFvq7UygVF299anyUGp-gjo8RxyckJ0clJ8epg-yo1tlR6jBqiYtCKjGhdV1uuw_LDa0BmQGccuR8Gd0bBKI5vAXkwbn61mOWcgQ3FYehg89dBDEE-N5_dj_kwZM5dFohLa4gmvdVJuiYyv7uEQPJUaDJcaB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