<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/88802>88802</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[LoopVectorize] Assertion 'VecTy.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE && "Simple vector VT not representable by simple integer vector VT!"' failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
patrick-rivos
</td>
</tr>
</table>
<pre>
Testcase:
```llvm ir
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
target triple = "riscv64-unknown-linux-gnu"
define void @c() #0 {
entry:
br label %for.cond
for.cond: ; preds = %cond.end, %entry
%f.0 = phi i32 [ 0, %entry ], [ %add, %cond.end ]
%add = add i32 %f.0, 1
br i1 false, label %cond.false, label %cond.true
cond.true: ; preds = %for.cond
%conv10 = trunc i64 0 to i32
br label %cond.end
cond.false: ; preds = %for.cond
%tobool15 = zext i8 0 to i32
br label %cond.end
cond.end: ; preds = %cond.false, %cond.true
%cond = phi i32 [ %conv10, %cond.true ], [ 0, %cond.false ]
%0 = trunc i32 %cond to i8
%conv17 = and i8 %0, 0
store i8 %conv17, ptr null, align 1
%cmp = icmp slt i32 %f.0, 1
br i1 %cmp, label %for.cond, label %for.cond.cleanup
for.cond.cleanup: ; preds = %cond.end
ret void
}
attributes #0 = { "target-features"="+64bit,+a,+c,+d,+f,+m,+relax,+v,+zicsr,+zifencei,+zve32f,+zve32x,+zve64d,+zve64f,+zve64x,+zvl128b,+zvl256b,+zvl32b,+zvl64b,-e,-experimental-smmpm,-experimental-smnpm,-experimental-ssnpm,-experimental-sspm,-experimental-ssqosid,-experimental-supm,-experimental-zaamo,-experimental-zabha,-experimental-zalasr,-experimental-zalrsc,-experimental-zfbfmin,-experimental-zicfilp,-experimental-zicfiss,-experimental-ztso,-experimental-zvfbfmin,-experimental-zvfbfwma,-h,-shcounterenw,-shgatpa,-shtvala,-shvsatpa,-shvstvala,-shvstvecd,-smaia,-smepmp,-ssaia,-ssccptr,-sscofpmf,-sscounterenw,-ssstateen,-ssstrict,-sstc,-sstvala,-sstvecd,-ssu64xl,-svade,-svadu,-svbare,-svinval,-svnapot,-svpbmt,-xcvalu,-xcvbi,-xcvbitmanip,-xcvelw,-xcvmac,-xcvmem,-xcvsimd,-xsfcease,-xsfvcp,-xsfvfnrclipxfqf,-xsfvfwmaccqqq,-xsfvqmaccdod,-xsfvqmaccqoq,-xsifivecdiscarddlone,-xsifivecflushdlone,-xtheadba,-xtheadbb,-xtheadbs,-xtheadcmo,-xtheadcondmov,-xtheadfmemidx,-xtheadmac,-xtheadmemidx,-xtheadmempair,-xtheadsync,-xtheadvdot,-xventanacondops,-za128rs,-za64rs,-zacas,-zawrs,-zba,-zbb,-zbc,-zbkb,-zbkc,-zbkx,-zbs,-zca,-zcb,-zcd,-zce,-zcf,-zcmop,-zcmp,-zcmt,-zdinx,-zfa,-zfh,-zfhmin,-zfinx,-zhinx,-zhinxmin,-zic64b,-zicbom,-zicbop,-zicboz,-ziccamoa,-ziccif,-zicclsm,-ziccrse,-zicntr,-zicond,-zihintntl,-zihintpause,-zihpm,-zimop,-zk,-zkn,-zknd,-zkne,-zknh,-zkr,-zks,-zksed,-zksh,-zkt,-zmmul,-zvbb,-zvbc,-zvfh,-zvfhmin,-zvkb,-zvkg,-zvkn,-zvknc,-zvkned,-zvkng,-zvknha,-zvknhb,-zvks,-zvksc,-zvksed,-zvksg,-zvksh,-zvkt,-zvl1024b,-zvl16384b,-zvl2048b,-zvl32768b,-zvl4096b,-zvl512b,-zvl65536b,-zvl8192b" }
```
Godbolt: https://godbolt.org/z/oPrnTMzra
Backtrace:
```
opt: /scratch/tc-testing/tc-apr-15/llvm/llvm/include/llvm/CodeGenTypes/MachineValueType.h:205: llvm::MVT llvm::MVT::changeVectorElementType(llvm::MVT) const: Assertion `VecTy.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE && "Simple vector VT not representable by simple integer vector VT!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt --passes=loop-vectorize reduced.ll
#0 0x0000555b3a56f1b0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x2da91b0)
#1 0x0000555b3a56c5bf llvm::sys::RunSignalHandlers() (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x2da65bf)
#2 0x0000555b3a56c715 SignalHandler(int) Signals.cpp:0:0
#3 0x00007ddb33242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007ddb332969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x00007ddb332969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#6 0x00007ddb332969fc pthread_kill ./nptl/pthread_kill.c:89:10
#7 0x00007ddb33242476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
#8 0x00007ddb332287f3 abort ./stdlib/abort.c:81:7
#9 0x00007ddb3322871b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007ddb33239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x0000555b37db5013 llvm::RISCVTTIImpl::getCastInstrCost(unsigned int, llvm::Type*, llvm::Type*, llvm::TargetTransformInfo::CastContextHint, llvm::TargetTransformInfo::TargetCostKind, llvm::Instruction const*) (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x5ef013)
#12 0x0000555b39cab110 llvm::TargetTransformInfo::getCastInstrCost(unsigned int, llvm::Type*, llvm::Type*, llvm::TargetTransformInfo::CastContextHint, llvm::TargetTransformInfo::TargetCostKind, llvm::Instruction const*) const (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x24e5110)
#13 0x0000555b395be60d llvm::LoopVectorizationCostModel::getInstructionCost(llvm::Instruction*, llvm::ElementCount, llvm::Type*&) (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x1df860d)
#14 0x0000555b395bf19a llvm::LoopVectorizationCostModel::getInstructionCost(llvm::Instruction*, llvm::ElementCount) (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x1df919a)
#15 0x0000555b395bf8c1 llvm::LoopVectorizationCostModel::expectedCost(llvm::ElementCount, llvm::SmallVectorImpl<std::pair<llvm::Instruction*, llvm::ElementCount>>*) (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x1df98c1)
#16 0x0000555b395c1f3d llvm::LoopVectorizationPlanner::selectVectorizationFactor(llvm::SmallSet<llvm::ElementCount, 16u, llvm::ElementCountComparator> const&) (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x1dfbf3d)
#17 0x0000555b395dad03 llvm::LoopVectorizationPlanner::plan(llvm::ElementCount, unsigned int) (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x1e14d03)
#18 0x0000555b395dcf35 llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x1e16f35)
#19 0x0000555b395dffee llvm::LoopVectorizePass::runImpl(llvm::Function&, llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::BlockFrequencyInfo*, llvm::TargetLibraryInfo*, llvm::DemandedBits&, llvm::AssumptionCache&, llvm::LoopAccessInfoManager&, llvm::OptimizationRemarkEmitter&, llvm::ProfileSummaryInfo*) (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x1e19fee)
#20 0x0000555b395e113d llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x1e1b13d)
#21 0x0000555b384dc396 llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0xd16396)
#22 0x0000555b3a394451 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x2bce451)
#23 0x0000555b384d3c26 llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0xd0dc26)
#24 0x0000555b3a39312b llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x2bcd12b)
#25 0x0000555b384dbee6 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0xd15ee6)
#26 0x0000555b3a390f61 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x2bcaf61)
#27 0x0000555b37d55205 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x58f205)
#28 0x0000555b37d47836 optMain (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x581836)
#29 0x00007ddb33229d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#30 0x00007ddb33229e40 call_init ./csu/../csu/libc-start.c:128:20
#31 0x00007ddb33229e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#32 0x0000555b37d3d4b5 _start (/scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt+0x5774b5)
zsh: IOT instruction (core dumped) /scratch/tc-testing/tc-apr-15/build-rv64gcv/build-llvm-linux/bin/opt
```
Found via fuzzer.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWttz46yS_2uUF5VdErpYfsiDc_E5qZ3ZL_Ulm6p9ciFANhsEGkAax3_9FhfJku3MycxOds-ebypjmgaa7l83DUiCStEtJ-Q6yG6C7O4Ktnon5HUDtaTodSZpJ9RVKfDb9TNRGkFFgmQVRHdBtAryyP0x1tUhlY6rodwSHWKoIYNvotVhkNyFAQBkVgfJisyaIFnlqf2Z0YGIQREkqxgUM54Ax3syPAAmYrWkDSO9SEkV6vJ01vJXLr7zGaO83c-2vB2GuV9MKspJ2AmKwyCNUGAEL8MAJFEYLG5cJ8K1fBuMC8NShgyWhIUByCoh50hwPBY68JJV-NF_QXITNpJg5S3IjIA54TgAt6bqdPAKmHnnke3Z7GhIExAG2U0YjfuGQXZn69mN4UHcS-oF2w5HgRBjK9CUVqCdw4yJR3bTOKwg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