<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/148438>148438</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[SLP] Assertion `isSimple() && "Expected a SimpleValueType!"' failed
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
sjoerdmeijer
</td>
</tr>
</table>
<pre>
For the IR shown in https://godbolt.org/z/Gv1nEe6de, the SLP vectoriser is running into this assert:
```
opt: /root/llvm-project/llvm/include/llvm/CodeGen/ValueTypes.h:312: llvm::MVT llvm::EVT::getSimpleVT() const: Assertion `isSimple() && "Expected a SimpleValueType!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -S -passes=slp-vectorizer <source>
1. Running pass "function(slp-vectorizer)" on module "<source>"
2. Running pass "slp-vectorizer" on function "_Z1bPbPA6_b"
#0 0x0000000005642db8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5642db8)
#1 0x000000000563fc64 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x000072d577242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x000072d5772969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x000072d577242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x000072d5772287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x000072d57722871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x000072d577239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x0000000000ba7819 llvm::AArch64TTIImpl::getArithmeticInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo::TargetCostKind, llvm::TargetTransformInfo::OperandValueInfo, llvm::TargetTransformInfo::OperandValueInfo, llvm::ArrayRef<llvm::Value const*>, llvm::Instruction const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xba7819)
#9 0x0000000004d27ce6 llvm::TargetTransformInfo::getArithmeticInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo::TargetCostKind, llvm::TargetTransformInfo::OperandValueInfo, llvm::TargetTransformInfo::OperandValueInfo, llvm::ArrayRef<llvm::Value const*>, llvm::Instruction const*, llvm::TargetLibraryInfo const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4d27ce6)
#10 0x00000000034dd04d llvm::InstructionCost llvm::function_ref<llvm::InstructionCost (llvm::InstructionCost)>::callback_fn<llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>, llvm::SmallPtrSetImpl<llvm::Value*>&)::'lambda13'(llvm::InstructionCost)>(long, llvm::InstructionCost) SLPVectorizer.cpp:0:0
#11 0x0000000003530881 llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>, llvm::SmallPtrSetImpl<llvm::Value*>&)::'lambda0'(llvm::function_ref<llvm::InstructionCost (unsigned int)>, llvm::function_ref<llvm::InstructionCost (llvm::InstructionCost)>)::operator()(llvm::function_ref<llvm::InstructionCost (unsigned int)>, llvm::function_ref<llvm::InstructionCost (llvm::InstructionCost)>) const SLPVectorizer.cpp:0:0
#12 0x000000000353a29f llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>, llvm::SmallPtrSetImpl<llvm::Value*>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x353a29f)
#13 0x0000000003570987 llvm::slpvectorizer::BoUpSLP::getTreeCost(llvm::ArrayRef<llvm::Value*>, llvm::InstructionCost) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3570987)
#14 0x000000000357b60a llvm::SLPVectorizerPass::tryToVectorizeList(llvm::ArrayRef<llvm::Value*>, llvm::slpvectorizer::BoUpSLP&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x357b60a)
#15 0x000000000357d9ba llvm::SLPVectorizerPass::vectorizeGEPIndices(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x357d9ba)
#16 0x000000000358a3f5 llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) (.part.0) SLPVectorizer.cpp:0:0
#17 0x000000000358ae3b llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x358ae3b)
#18 0x0000000002d8a12e llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2d8a12e)
#19 0x00000000054375c1 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x54375c1)
```
I haven't reduced the IR, but hopefully this is a good start.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsWd9v4yoW_mvIC0pk498PeXDb5G61Hd2oyfZhXypsiMMUgwW408xfvwI7dZx07qRzs9Lu3a1SKQbOxznfdzhggrVmlaB0DqIbEN1NcGt2Us31V0kVqSn7StWkkGQ_X0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