<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64868>64868</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir][llvmir] crash when mlir-translate parsing dense_resource
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
EllisLambda
</td>
</tr>
</table>
<pre>
[The MLIR code](https://paste.opensuse.org/pastes/4be038016182)
Running
```
mlir-translate --mlir-to-llvmir
```
will produce:
```
ElementsAttr does not provide iteration facilities for type `mlir::Attribute`, see attribute: dense_resource<__elided__> : tensor<2x128xf32>
invalid `T` for ElementsAttr::getValues
UNREACHABLE executed at /home/sym/buddy-mlir/llvm/mlir/include/mlir/IR/BuiltinAttributeInterfaces.h:308!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: ../../llvm/build/bin/mlir-translate --mlir-to-llvmir
#0 0x000000000072122b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (../../llvm/build/bin/mlir-translate+0x72122b)
#1 0x000000000071e36b llvm::sys::RunSignalHandlers() (../../llvm/build/bin/mlir-translate+0x71e36b)
#2 0x000000000071e495 SignalHandler(int) Signals.cpp:0:0
#3 0x00007fd56ba3f1f0 __restore_rt (/lib64/libc.so.6+0x3f1f0)
#4 0x00007fd56ba91e4c __pthread_kill_implementation (/lib64/libc.so.6+0x91e4c)
#5 0x00007fd56ba3f126 gsignal (/lib64/libc.so.6+0x3f126)
#6 0x00007fd56ba26917 abort (/lib64/libc.so.6+0x26917)
#7 0x0000000000717a0a (../../llvm/build/bin/mlir-translate+0x717a0a)
#8 0x000000000087f69e _ZNK4mlir12ElementsAttr9getValuesINS_9AttributeEEENSt9enable_ifIXoosrSt7is_sameIS2_T_E5valuentsrSt10is_base_ofIS2_S5_E5valueENS_6detail17ElementsAttrRangeINS9_20ElementsAttrIteratorIS5_EEEEE4typeEv TensorOps.cpp:0:0
#9 0x0000000000b11082 mlir::LLVM::detail::getLLVMConstant(llvm::Type*, mlir::Attribute, mlir::Location, mlir::LLVM::ModuleTranslation const&) (../../llvm/build/bin/mlir-translate+0xb11082)
#10 0x0000000000b1664c mlir::LLVM::ModuleTranslation::convertGlobals() (../../llvm/build/bin/mlir-translate+0xb1664c)
#11 0x0000000000b1dfd9 mlir::translateModuleToLLVMIR(mlir::Operation*, llvm::LLVMContext&, llvm::StringRef) (../../llvm/build/bin/mlir-translate+0xb1dfd9)
#12 0x0000000000af2a59 std::_Function_handler<mlir::LogicalResult (mlir::Operation*, llvm::raw_ostream&), mlir::registerToLLVMIRTranslation()::'lambda'(mlir::Operation*, llvm::raw_ostream&)>::_M_invoke(std::_Any_data const&, mlir::Operation*&&, llvm::raw_ostream&) ConvertToLLVMIR.cpp:0:0
#13 0x0000000000f7f20f std::_Function_handler<mlir::LogicalResult (std::shared_ptr<llvm::SourceMgr> const&, llvm::raw_ostream&, mlir::MLIRContext*), mlir::TranslateFromMLIRRegistration::TranslateFromMLIRRegistration(llvm::StringRef, llvm::StringRef, std::function<mlir::LogicalResult (mlir::Operation*, llvm::raw_ostream&)> const&, std::function<void (mlir::DialectRegistry&)> const&)::'lambda'(std::shared_ptr<llvm::SourceMgr> const&, llvm::raw_ostream&, mlir::MLIRContext*)>::_M_invoke(std::_Any_data const&, std::shared_ptr<llvm::SourceMgr> const&, llvm::raw_ostream&, mlir::MLIRContext*&&) Translation.cpp:0:0
#14 0x0000000000f7b200 mlir::mlirTranslateMain(int, char**, llvm::StringRef)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)::operator()(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) const MlirTranslateMain.cpp:0:0
#15 0x0000000000f7b47e mlir::LogicalResult llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::mlirTranslateMain(int, char**, llvm::StringRef)::'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&) MlirTranslateMain.cpp:0:0
#16 0x0000000000f89c83 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) (../../llvm/build/bin/mlir-translate+0xf89c83)
#17 0x0000000000f7bd17 mlir::mlirTranslateMain(int, char**, llvm::StringRef) (../../llvm/build/bin/mlir-translate+0xf7bd17)
#18 0x00000000006e9b79 main (../../llvm/build/bin/mlir-translate+0x6e9b79)
#19 0x00007fd56ba281f0 __libc_start_call_main (/lib64/libc.so.6+0x281f0)
#20 0x00007fd56ba282b9 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x282b9)
#21 0x00000000006e9a65 _start /home/abuild/rpmbuild/BUILD/glibc-2.38/csu/../sysdeps/x86_64/start.S:117:0
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWM1y47gRfhrogrKKBP8PPsiytKuK7Z2SvFupXFgg2aSQAQEGAD3W26dAUhIp2-OJNtlNopoxKfx0f91fdwNqqjWrBMAtCu5QcD-jrdlLdbvinOkHWmcFnWWyONjp5z3gx4fNFueyABTcIxLvjWk08haIrBFZN1QbmMsGhG41zKWqjoMakbWfgePFjhu6MUEkQc49chbbVggmKtx_Q6Ez_Ou-1pypG6Oo0JwawDc3_YC84fylZupizyDjG-McN0oWbQ4WWb_oPfErDjUIoxfGKFxI0FhIY7e-sAIwM6C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