<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/70887>70887</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [mlir] --inline 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: 604eff60abfce09f956c3b0b1414f8d0d04b5d47

system: ```Ubuntu 20.04.6 LTS (Focal Fossa)```

reproduced with: ```mlir-opt --inline a.mlir```

a.mlir:
```
func.func @func2() -> tensor<?x?x?xf16> {
  %idx27 = index.constant 27
  %idx-3 = index.constant -3  // negative integer
  %c10 = arith.constant 10 : index
  %11 = bufferization.alloc_tensor(%c10, %idx-3, %idx27) : tensor<?x?x?xf16>
 return %11 : tensor<?x?x?xf16>
}
```

trace:
```
<unknown>:0: error: invalid tensor dimension size
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 --inline a.mlir
 #0 0x000055617994381f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin/llvm-project/build/bin/mlir-opt+0x15d981f)
 #1 0x00005561799408b4 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fea76425420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007fea75f1000b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #4 0x00007fea75eef859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #5 0x00007fea75eef729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #6 0x00007fea75f00fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #7 0x000055617c64c07f 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+0x42e207f)
 #8 0x000055617c64c0cd mlir::RankedTensorType::get(llvm::ArrayRef<long>, mlir::Type, mlir::Attribute) (/data/bin/llvm-project/build/bin/mlir-opt+0x42e20cd)
 #9 0x0000556179dddaaa (anonymous namespace)::ReplaceStaticShapeDims::matchAndRewrite(mlir::bufferization::AllocTensorOp, mlir::PatternRewriter&) const BufferizationOps.cpp:0:0
#10 0x0000556179dc0e48 mlir::detail::OpOrInterfaceRewritePatternBase<mlir::bufferization::AllocTensorOp>::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/data/bin/llvm-project/build/bin/mlir-opt+0x1a56e48)
#11 0x000055617f1aaf68 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+0x6e40f68)
#12 0x000055617c5629ac (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
#13 0x000055617c566e1b mlir::applyPatternsAndFoldGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/data/bin/llvm-project/build/bin/mlir-opt+0x41fce1b)
#14 0x000055617c4ccbda (anonymous namespace)::Canonicalizer::runOnOperation() Canonicalizer.cpp:0:0
#15 0x000055617c4adb2e mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x4143b2e)
#16 0x000055617c4ae00a 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+0x414400a)
#17 0x000055617c4af0d3 mlir::LogicalResult llvm::function_ref<mlir::LogicalResult (mlir::OpPassManager&, mlir::Operation*)>::callback_fn<mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::'lambda'(mlir::OpPassManager&, mlir::Operation*)>(long, mlir::OpPassManager&, mlir::Operation*) Pass.cpp:0:0
#18 0x000055617c4dcdc3 (anonymous namespace)::InlinerPass::optimizeCallable(mlir::CallGraphNode*, llvm::StringMap<mlir::OpPassManager, llvm::MallocAllocator>&) Inliner.cpp:0:0
#19 0x000055617c4e5745 mlir::LogicalResult llvm::function_ref<mlir::LogicalResult ((anonymous namespace)::CallGraphSCC&)>::callback_fn<(anonymous namespace)::InlinerPass::runOnOperation()::'lambda'((anonymous namespace)::CallGraphSCC&)>(long, (anonymous namespace)::CallGraphSCC&) Inliner.cpp:0:0
#20 0x000055617c4e6a53 (anonymous namespace)::InlinerPass::runOnOperation() Inliner.cpp:0:0
#21 0x000055617c4adb2e mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x4143b2e)
#22 0x000055617c4ae00a 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+0x414400a)
#23 0x000055617c4ae834 mlir::PassManager::run(mlir::Operation*) (/data/bin/llvm-project/build/bin/mlir-opt+0x4144834)
#24 0x000055617c49f5bb performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#25 0x000055617c4a0a74 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
#26 0x000055617c4a0c24 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
#27 0x000055617c59d174 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+0x4233174)
#28 0x000055617c4996d7 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+0x412f6d7)
#29 0x000055617c4a0d71 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x4136d71)
#30 0x000055617c4a11d6 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x41371d6)
#31 0x000055617987ad9b main (/data/bin/llvm-project/build/bin/mlir-opt+0x1510d9b)
#32 0x00007fea75ef1083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#33 0x0000556179913f8e _start (/data/bin/llvm-project/build/bin/mlir-opt+0x15a9f8e)
Aborted (core dumped)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsGktT4zj615iLipQsvw8cQtKZpapZKMLUHlOy9DnRtiN7JZmG_vVbkp3EDkmADjPbuztTDLit7_2WLKq1WEqAKy-69qLpBW3MqlJXVFbyZV01-nYyv8gr_nK1FAY9gdKikl4wRjEOoShiTPOCAc6KLIpZkOPcD_2wSDnmOMwjHiYennp43P7WL9rA2mJ7MW5_fs8baRpE8AiHoxh9fZwjj6SzitESzSqtqUeyLXCfloJaVbxhwNF3YVYDoutSqMuqNujyUshSSEB0ZN8dJNQtBd0_92CKRrKR_YW8ENu_xCOpRzJ06QVfkAGpK-UFEy-YPW_-L_zYrnnJdUsCIY9Egj-TBHnBFAnJ4XnEKqkNlQaRZAh1GRyCugzs-swjMyRhSY14AiSkgSWoHjrzsUOmSpjVDtm9Hbcke9C-74DzpihAiR_UiEqOaFlWbNHpZTW1RD0y2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