<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/110382>110382</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Assertion Failure in Vector Combine
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Zentrik
</td>
</tr>
</table>
<pre>
Runnning vector-combine pass on
```llvm
source_filename = "text"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128-ni:10:11:12:13"
target triple = "x86_64-unknown-linux-gnu"
define nonnull ptr addrspace(10) @wombat() {
%call = call <4 x i64> @llvm.fshl.v4i64(<4 x i64> zeroinitializer, <4 x i64> zeroinitializer, <4 x i64> <i64 45, i64 45, i64 45, i64 45>) [ "jl_roots"(ptr addrspace(10) null, ptr addrspace(10) null) ]
%shufflevector = shufflevector <4 x i64> %call, <4 x i64> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%shufflevector1 = shufflevector <16 x i64> %shufflevector, <16 x i64> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
ret ptr addrspace(10) null
}
declare <4 x i64> @llvm.fshl.v4i64(<4 x i64>, <4 x i64>, <4 x i64>)
```
produces
```
opt: /root/llvm-project/llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From*) [with To = llvm::FixedVectorType; From = llvm::Type]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' 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 -passes=vector-combine <source>
1. Running pass "function(vector-combine)" on module "<source>"
2. Running pass "vector-combine" on function "wombat"
#0 0x0000000005079b38 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5079b38)
#1 0x00000000050774ec SignalHandler(int) Signals.cpp:0:0
#2 0x000074d0dce42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x000074d0dce969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x000074d0dce42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x000074d0dce287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x000074d0dce2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x000074d0dce39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x0000000004186458 (anonymous namespace)::VectorCombine::foldShuffleToIdentity(llvm::Instruction&) VectorCombine.cpp:0:0
#9 0x0000000004190f01 (anonymous namespace)::VectorCombine::run()::'lambda'(llvm::Instruction&)::operator()(llvm::Instruction&) const (.isra.0) VectorCombine.cpp:0:0
#10 0x0000000004191c25 llvm::VectorCombinePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4191c25)
#11 0x0000000002f2defe llvm::detail::PassModel<llvm::Function, llvm::VectorCombinePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2f2defe)
#12 0x0000000004e7c978 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4e7c978)
#13 0x0000000000e157ce llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xe157ce)
#14 0x0000000004e7b39e llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4e7b39e)
#15 0x0000000000e14f7e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xe14f7e)
#16 0x0000000004e7add0 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4e7add0)
#17 0x0000000000904cc2 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) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x904cc2)
#18 0x00000000008f7b4c optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x8f7b4c)
#19 0x000074d0dce29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#20 0x000074d0dce29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#21 0x00000000008ef61e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x8ef61e)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
Godbolt: https://godbolt.org/z/MGefYs3M5
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWV-P26oS_zTkBSXC-P9DHrLZTW91z-pWJ6tK975E2OCEswQswO2mn_4KcJw4m-5p2h6papW6GGZ-M_NjGDAlxvCtZGwO0juQ3k9IZ3dKz__HpNX8eVIpepj_2UkpudzCT6y2Sk9rta-4ZLAlxkAlIUD3AC1AhsJPiE_70GVUp2u2abhgkuwZBPE9BBhb9mIBxkHGEr1lFlJiiSAH1dmjFJvuQbxg0xbnCMSLGPuHe43Gr66VJf4x5UMjwgWIFxEupk2B-pb0XdlRPUuma9_NXbcXiryke8SXHlrNWzHE8FJkmyyZdvJZqs9yKrjsXqZb2Q1a4UlZ45iSSspOCNhaDQml2rSkZgAXEQK4hCBBn9W-Ihbgwr_nd0EbQoDTmgjhrfaNZQJfoI_zwWk6tmeN2YnZp8T1urDPRb4wrbjklhPBvzAN8BLeKADiJc8SmKRu6I1W_OCdT-8cP3-JjVbKGscHLq7H7Shx-m-NOsD7MzbMrmsawUImeloue0auB_pex9QqbpTs-6PMDbiUCMHGGCIfV4xhdGzgYyM-Nk4Yv-hb_PA14qLrzAUiBupG4yOugkgnKWt-jEM8COGT1CCGT3LJ0EqHVja08qFVDK1yMDbYiKMzTjSzb2VeWMT5_Xg114JodvMifJV_VzrKiyoaXlutaFczc3VQtRbECwjwyi01gFfOjWmr1V-sPr4CvOKyFh1lp45117ZKO4klMZbL7WwH4kWau-oIXYz20Do2SGeV48OrxQsQL2piXJFaabUHeNEv98_c7uCT8il1El3xF0Y_-tR5cnDxHXRqF1J-KL13hhfGMG25208yxA0B8fJJeWqKjyRUAjfjmasu3o94-XQI426Q6G23Z9JC1UAua7VvieWVYDAEE_lClMOGcMHoLBD44Y-HxfoBmq7acwsJrLot1MxxA62CO2tb49zEK4BXW253XTWrXeRHIi_45sZ0zAC8gkRS2NMO7Y7BWhOzgxWpn60mNevNry2pnyHt9q2z4rvQDKDyg1ZbTfZDSKafZTffeOVC44LpKXtphdKuYq9qQeR2So4M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