<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/70415>70415</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir] --tosa-infer-shapes crashed with assertion failure "Invalid index!"
</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: 0359a78f77fbee15a3c3ca9e6a44301336cc0f6e
system: ```Ubuntu 20.04.6 LTS (Focal Fossa)```
reproduced with: ```mlir-opt --tosa-infer-shapes a.mlir```
a.mlir:
```
func.func nested @func2(%arg0: tensor<9xi64>) {
%7 = tensor.empty() : tensor<9xi1>
%28 = tensor.empty() : tensor<9xi1>
%29 = tosa.logical_left_shift %7, %28 : (tensor<9xi1>, tensor<9xi1>) -> tensor<9xi1>
%32 = tosa.tile %29 {multiples = array<i64>} : (tensor<9xi1>) -> tensor<9xi1>
return
}
```
trace:
```
mlir-opt: /data/bin/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:257: const T& llvm::ArrayRef<T>::operator[](size_t) const [with T = long int; size_t = long unsigned int]: Assertion `Index < Length && "Invalid index!"' 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-infer-shapes reduced.mlir
#0 0x000055655709ca9f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin/llvm-project/build/bin/mlir-opt+0x15d2a9f)
#1 0x0000556557099b34 SignalHandler(int) Signals.cpp:0:0
#2 0x00007ff274b83420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007ff27466e00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007ff27464d859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x00007ff27464d729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#6 0x00007ff27465efd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#7 0x0000556558dafd45 (/data/bin/llvm-project/build/bin/mlir-opt+0x32e5d45)
#8 0x0000556558e351fd mlir::tosa::TileOp::inferReturnTypeComponents(mlir::MLIRContext*, std::optional<mlir::Location>, mlir::tosa::TileOpAdaptor, llvm::SmallVectorImpl<mlir::ShapedTypeComponents>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x336b1fd)
#9 0x0000556558e35461 mlir::detail::InferShapedTypeOpInterfaceInterfaceTraits::Model<mlir::tosa::TileOp>::inferReturnTypeComponents(mlir::MLIRContext*, std::optional<mlir::Location>, mlir::ValueShapeRange, mlir::DictionaryAttr, mlir::OpaqueProperties, mlir::RegionRange, llvm::SmallVectorImpl<mlir::ShapedTypeComponents>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x336b461)
#10 0x0000556558e90d0a (anonymous namespace)::propagateShapesInRegion(mlir::Region&) TosaInferShapes.cpp:0:0
#11 0x0000556558e9279e (anonymous namespace)::TosaInferShapes::runOnOperation() TosaInferShapes.cpp:0:0
#12 0x0000556559bfa86e mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x413086e)
#13 0x0000556559bfad4a 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+0x4130d4a)
#14 0x0000556559bfb74c mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::'lambda'(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&)::operator()(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&) const Pass.cpp:0:0
#15 0x0000556559bf9ea5 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/data/bin/llvm-project/build/bin/mlir-opt+0x412fea5)
#16 0x0000556559bfa60a mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x413060a)
#17 0x0000556559bfad4a 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+0x4130d4a)
#18 0x0000556559bfb574 mlir::PassManager::run(mlir::Operation*) (/data/bin/llvm-project/build/bin/mlir-opt+0x4131574)
#19 0x0000556559bebe3b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#20 0x0000556559bed2f4 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
#21 0x0000556559bed4a4 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
#22 0x0000556559ce9eb4 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+0x421feb4)
#23 0x0000556559be6777 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+0x411c777)
#24 0x0000556559bed7cb mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x41237cb)
#25 0x0000556556fd4b8b main (/data/bin/llvm-project/build/bin/mlir-opt+0x150ab8b)
#26 0x00007ff27464f083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#27 0x000055655706d33e _start (/data/bin/llvm-project/build/bin/mlir-opt+0x15a333e)
Aborted (core dumped)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWV1v27jS_jXMDRGDIvV5kQvHSfAGSJAg8bu3BiWNbJ6lSS1J7cbn1x-Q8oekJmnaFN3uwSlaVRbJmWee-dBQ5NaKtQK4QMklSq7OeOc22lxwpdVuqzt7v3g-K3W9u1gLh_8EY4VWiM0xYUnBs7zJsqYEiBLOKlbxAlIex4xEjKVVRZoUELlCZN5f7c462PrVKCX93_8vO-U6TMmMxLMU3y2fMaL5ja64xDfaWo5ocZw8lGWgNbruKqjxX8JtRkK3Uphz3Tp8fu605edCNWDO7Ya3YDGf-eFXZe6H2Hz4cDKz6VQ18xeswDqoMYqJ_0kRzRFNuFkTj8WBstogtiheRBojdo1ogVF22QvBGNEkw4hd7SfOYNu6XRBR4On6yC_v1yGa0Pw71oWFRb9QWz6Tei0qLlcSGreyG9G4gAjRxVG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