Bug type: crash
Component: SLPVectorizer
Bug location: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp: BoUpSLP::vectorizeTree
getSplitMask
Issue title: [SLP][REVEC][X86] Assertion "Expected item in MinBWs."' failed.
Labels: llvm:SLPVectorizer
crash-on-valid
Reported by: Andarwinux

https://rust.godbolt.org/z/x9G9q6rGx

with assertions:
```
clang: /root/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:20933: llvm::Value* llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::slpvectorizer::BoUpSLP::TreeEntry*): Assertion `(It != MinBWs.end() || getOperandEntry(E, 0)->isGather() || getOperandEntry(E, 1)->isGather() || MinBWs.contains(getOperandEntry(E, 0)) || MinBWs.contains(getOperandEntry(E, 1))) && "Expected item in MinBWs."' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -O3 -march=znver5 -fprofile-generate -mllvm -slp-revec -mllvm -inline-threshold=349 <source>
1.	<eof> parser at end of file
2.	Optimizer
3.	Running pass "function<eager-inv>(drop-unnecessary-assumes,float2int,lower-constant-intrinsics,chr,loop(loop-rotate<header-duplication;no-prepare-for-lto>,loop-deletion),loop-distribute,inject-tli-mappings,loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,drop-unnecessary-assumes,infer-alignment,loop-load-elim,instcombine<max-iterations=1;no-verify-fixpoint>,simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;switch-to-lookup;no-keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,slp-vectorizer,vector-combine,instcombine<max-iterations=1;no-verify-fixpoint>,loop-unroll<O3>,transform-warning,sroa<preserve-cfg>,infer-alignment,instcombine<max-iterations=1;no-verify-fixpoint>,loop-mssa(licm<allowspeculation>),alignment-from-assumptions,loop-sink,instsimplify,div-rem-pairs,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;speculate-unpredictables>)" on module "<source>"
4.	Running pass "slp-vectorizer" on function "svt_av1_inv_txfm2d_add_8x8_sse4_1"
 #0 0x00000000043ccce8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x43ccce8)
 #1 0x00000000043ca144 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x43ca144)
 #2 0x000000000430a3c8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x0000745b97642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000745b976969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x0000745b97642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x0000745b976287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x0000745b9762871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x0000745b97639e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00000000060a35de llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::slpvectorizer::BoUpSLP::TreeEntry*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x60a35de)
#10 0x00000000060a299b llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::slpvectorizer::BoUpSLP::TreeEntry*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x60a299b)
#11 0x00000000060c1f24 llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::SmallDenseSet<llvm::Value*, 4u, llvm::DenseMapInfo<llvm::Value*, void>> const&, llvm::Instruction*, llvm::ArrayRef<std::tuple<llvm::Value*, unsigned int, bool>>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x60c1f24)
#12 0x00000000060c6254 llvm::slpvectorizer::BoUpSLP::vectorizeTree() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x60c6254)
#13 0x00000000060e7104 llvm::SLPVectorizerPass::tryToVectorizeList(llvm::ArrayRef<llvm::Value*>, llvm::slpvectorizer::BoUpSLP&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x60e7104)
#14 0x00000000060eb79c bool tryToVectorizeSequence<llvm::Value>(llvm::SmallVectorImpl<llvm::Value*>&, llvm::function_ref<bool (llvm::Value*, llvm::Value*)>, llvm::function_ref<bool (llvm::ArrayRef<llvm::Value*>, llvm::Value*)>, llvm::function_ref<bool (llvm::ArrayRef<llvm::Value*>, bool)>, bool, llvm::slpvectorizer::BoUpSLP&) (.constprop.0) SLPVectorizer.cpp:0:0
#15 0x00000000060eca2c llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x60eca2c)
#16 0x00000000060f4966 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 0x00000000060f57eb llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x60f57eb)
#18 0x00000000055e1b5e 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/clang+0x55e1b5e)
#19 0x0000000003d00961 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3d00961)
#20 0x000000000129bb5e 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/clang+0x129bb5e)
#21 0x0000000003cfef1a llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3cfef1a)
#22 0x000000000129be0e 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/clang+0x129be0e)
#23 0x0000000003cfe8d1 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3cfe8d1)
#24 0x0000000004693b6c (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&, clang::BackendConsumer*) BackendUtil.cpp:0:0
#25 0x0000000004697438 clang::emitBackendOutput(clang::CompilerInstance&, clang::CodeGenOptions&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4697438)
#26 0x0000000004d44667 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4d44667)
#27 0x0000000006b6bd5c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6b6bd5c)
#28 0x0000000004d44ac8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4d44ac8)
#29 0x0000000005042b95 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5042b95)
#30 0x0000000004fc202e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4fc202e)
#31 0x000000000513e25d clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x513e25d)
#32 0x0000000000de942e cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xde942e)
#33 0x0000000000ddfdfa ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#34 0x0000000000ddff7d int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::'lambda'(llvm::SmallVectorImpl<char const*>&)>(long, llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#35 0x0000000004db8599 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#36 0x000000000430a864 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x430a864)
#37 0x0000000004db8baf clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#38 0x0000000004d79532 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4d79532)
#39 0x0000000004d7a4de clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4d7a4de)
#40 0x0000000004d81795 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4d81795)
#41 0x0000000000de57a1 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xde57a1)
#42 0x0000000000c9f604 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xc9f604)
#43 0x0000745b97629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#44 0x0000745b97629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#45 0x0000000000ddf895 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xddf895)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
without assertions:
```
fatal error: error in backend: Cannot select: 0x120723c0: v16i32 = sign_extend 0x11fd8e90, example.c:214:28 @[ example.c:355:9 ]
  0x11fd8e90: v4i32 = bitcast 0x12033400, example.c:214:28 @[ example.c:355:9 ]
    0x12033400: v2i64 = extract_subvector 0x12033550, Constant:i64<0>, example.c:214:28 @[ example.c:355:9 ]
      0x12033550: v4i64 = X86ISD::VPERMV3 0x122e7f80, 0x12033470, 0x122e8140, example.c:189:14 @[ example.c:355:9 ]
        0x122e7f80: v4i64 = bitcast 0x12364470, example.c:189:14 @[ example.c:355:9 ]
          0x12364470: v8i32 = extract_subvector 0x122e8450, Constant:i64<0>, example.c:189:14 @[ example.c:355:9 ]
            0x122e8450: v16i32 = sub nsw 0x11fd8bf0, 0x12034190, example.c:191:14 @[ example.c:355:9 ]
              0x11fd8bf0: v16i32 = X86ISD::VSRAI 0x12364cc0, TargetConstant:i8<12>, example.c:165:14 @[ example.c:355:9 ]
                0x12364cc0: v16i32 = bitcast 0x124969c0, example.c:164:14 @[ example.c:355:9 ]
                  0x124969c0: v8i64 = X86ISD::SHUF128 0x12119a10, 0x12496800, TargetConstant:i8<-28>, example.c:164:14 @[ example.c:355:9 ]


              0x12034190: v16i32 = X86ISD::VSRAI 0x12364c50, TargetConstant:i8<12>, example.c:181:14 @[ example.c:355:9 ]
                0x12364c50: v16i32 = add 0x122e7e30, 0x12496fe0, example.c:180:14 @[ example.c:355:9 ]
                  0x122e7e30: v16i32 = add 0x122e7730, 0x122e7650, example.c:179:14 @[ example.c:355:9 ]


                  0x12496fe0: v16i32,ch = X86ISD::VBROADCAST_LOAD<(load (s32) from constant-pool)> 0x12021300, 0x12080290, example.c:144:14 @[ example.c:355:9 ]

        0x12033470: v4i64,ch = load<(load (s256) from constant-pool)> 0x12021300, 0x120334e0, undef:i64, example.c:189:14 @[ example.c:355:9 ]
          0x120334e0: i64 = X86ISD::WrapperRIP TargetConstantPool:i64<<4 x i64> <i64 1, i64 5, i64 4, i64 0>> 0
        0x122e8140: v4i64 = bitcast 0x123644e0, example.c:189:14 @[ example.c:355:9 ]
          0x123644e0: v8i32 = extract_subvector 0x122e7960, Constant:i64<0>, example.c:189:14 @[ example.c:355:9 ]
            0x122e7960: v16i32 = add nsw 0x12034190, 0x11fd8bf0, example.c:189:14 @[ example.c:355:9 ]
              0x12034190: v16i32 = X86ISD::VSRAI 0x12364c50, TargetConstant:i8<12>, example.c:181:14 @[ example.c:355:9 ]
                0x12364c50: v16i32 = add 0x122e7e30, 0x12496fe0, example.c:180:14 @[ example.c:355:9 ]
                  0x122e7e30: v16i32 = add 0x122e7730, 0x122e7650, example.c:179:14 @[ example.c:355:9 ]


                  0x12496fe0: v16i32,ch = X86ISD::VBROADCAST_LOAD<(load (s32) from constant-pool)> 0x12021300, 0x12080290, example.c:144:14 @[ example.c:355:9 ]

              0x11fd8bf0: v16i32 = X86ISD::VSRAI 0x12364cc0, TargetConstant:i8<12>, example.c:165:14 @[ example.c:355:9 ]
                0x12364cc0: v16i32 = bitcast 0x124969c0, example.c:164:14 @[ example.c:355:9 ]
                  0x124969c0: v8i64 = X86ISD::SHUF128 0x12119a10, 0x12496800, TargetConstant:i8<-28>, example.c:164:14 @[ example.c:355:9 ]


In function: svt_av1_inv_txfm2d_add_8x8_sse4_1
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-trunk/bin/clang -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -O3 -march=znver5 -fprofile-generate -mllvm -slp-revec -mllvm -inline-threshold=349 <source>
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '<source>'.
4.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@svt_av1_inv_txfm2d_add_8x8_sse4_1'
 #0 0x0000000003df8838 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3df8838)
 #1 0x0000000003df622c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3df622c)
 #2 0x0000000003d396f3 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3d396f3)
 #3 0x0000000003deda8e llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3deda8e)
 #4 0x0000000000ded5cb LLVMErrorHandler(void*, char const*, bool) cc1_main.cpp:0:0
 #5 0x0000000003d42193 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3d42193)
 #6 0x000000000533f1fa llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x533f1fa)
 #7 0x000000000534520d llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int, unsigned char const*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x534520d)
 #8 0x00000000028e2eb1 (anonymous namespace)::X86DAGToDAGISel::Select(llvm::SDNode*) X86ISelDAGToDAG.cpp:0:0
 #9 0x000000000533c2c4 llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-trunk/bin/clang+0x533c2c4)
#10 0x0000000005349322 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/clang+0x5349322)
#11 0x000000000534bd9a llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x534bd9a)
#12 0x000000000534df55 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x534df55)
#13 0x000000000533be61 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x533be61)
#14 0x00000000031d6b2d llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x31d6b2d)
#15 0x0000000003741422 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3741422)
#16 0x00000000037416b1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x37416b1)
#17 0x0000000003742f27 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3742f27)
#18 0x0000000004096bfe clang::emitBackendOutput(clang::CompilerInstance&, clang::CodeGenOptions&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x4096bfe)
#19 0x00000000046c9dab clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x46c9dab)
#20 0x000000000636c74c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x636c74c)
#21 0x00000000046ca905 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+0x46ca905)
#22 0x00000000049e294a clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+0x49e294a)
#23 0x000000000495fd6b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x495fd6b)
#24 0x0000000004ad952b clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x4ad952b)
#25 0x0000000000def75d cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+0xdef75d)
#26 0x0000000000de758b ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#27 0x0000000000de762d int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::'lambda'(llvm::SmallVectorImpl<char const*>&)>(long, llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#28 0x0000000004745d29 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#29 0x0000000003d395f3 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3d395f3)
#30 0x0000000004745f49 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#31 0x0000000004708fa2 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+0x4708fa2)
#32 0x0000000004709e81 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+0x4709e81)
#33 0x000000000471287c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x471287c)
#34 0x0000000000dec059 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0xdec059)
#35 0x0000000000c9e924 main (/opt/compiler-explorer/clang-trunk/bin/clang+0xc9e924)
#36 0x0000716796429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#37 0x0000716796429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#38 0x0000000000de7025 _start (/opt/compiler-explorer/clang-trunk/bin/clang+0xde7025)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Compiler returned: 70
```

-O3 -march=znver5 -fprofile-generate -mllvm -slp-revec -mllvm -inline-threshold=349




Fix patch:
commit 2ff4ec172a9e22f214a558a8a37a30ac4174b9c1
Author: Alexey Bataev <a.bataev@outlook.com>
Date:   Mon Feb 16 14:08:06 2026 -0800

    [SLP]Fix revec in split nodes
    
    Initially split nodes do not support vector entries in revec mode, patch
    fixes the issue by adding analysis for the scale factor
    
    Fixes #181546

diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index e50fb370ad7d..5e912ebeb5cb 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -3951,15 +3951,21 @@ private:
     SmallVector<int> getSplitMask() const {
       assert(State == TreeEntry::SplitVectorize && !ReorderIndices.empty() &&
              "Expected only split vectorize node.");
-      SmallVector<int> Mask(getVectorFactor(), PoisonMaskElem);
       unsigned CommonVF = std::max<unsigned>(
           CombinedEntriesWithIndices.back().second,
           Scalars.size() - CombinedEntriesWithIndices.back().second);
-      for (auto [Idx, I] : enumerate(ReorderIndices))
-        Mask[I] =
-            Idx + (Idx >= CombinedEntriesWithIndices.back().second
-                       ? CommonVF - CombinedEntriesWithIndices.back().second
-                       : 0);
+      const unsigned Scale = getNumElements(Scalars.front()->getType());
+      CommonVF *= Scale;
+      SmallVector<int> Mask(getVectorFactor() * Scale, PoisonMaskElem);
+      for (auto [Idx, I] : enumerate(ReorderIndices)) {
+        for (unsigned K : seq<unsigned>(Scale)) {
+          Mask[Scale * I + K] =
+              Scale * Idx + K +
+              (Idx >= CombinedEntriesWithIndices.back().second
+                   ? CommonVF - CombinedEntriesWithIndices.back().second * Scale
+                   : 0);
+        }
+      }
       return Mask;
     }
 
@@ -20395,16 +20401,18 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {
     }
     unsigned CommonVF =
         std::max(OpTE1.getVectorFactor(), OpTE2.getVectorFactor());
+    const unsigned Scale = getNumElements(ScalarTy);
+    CommonVF *= Scale;
     if (getNumElements(Op1->getType()) != CommonVF) {
       SmallVector<int> Mask(CommonVF, PoisonMaskElem);
-      std::iota(Mask.begin(), std::next(Mask.begin(), OpTE1.getVectorFactor()),
-                0);
+      copy(createReplicatedMask(Scale, OpTE1.getVectorFactor() * Scale),
+           Mask.begin());
       Op1 = Builder.CreateShuffleVector(Op1, Mask);
     }
     if (getNumElements(Op2->getType()) != CommonVF) {
       SmallVector<int> Mask(CommonVF, PoisonMaskElem);
-      std::iota(Mask.begin(), std::next(Mask.begin(), OpTE2.getVectorFactor()),
-                0);
+      copy(createReplicatedMask(Scale, OpTE2.getVectorFactor() * Scale),
+           Mask.begin());
       Op2 = Builder.CreateShuffleVector(Op2, Mask);
     }
     Value *Vec = Builder.CreateShuffleVector(Op1, Op2, E->getSplitMask());


Regression tests:
file: llvm/test/Transforms/SLPVectorizer/X86/revec-split-entry.ll
commands: opt -S --passes=slp-vectorizer -mtriple=x86_64-unknown-linux-gnu -mcpu=znver5 < %s -slp-revec
tests: test_name: <module>
test_body: 
define <8 x i16> @test(ptr %input, ptr %output_r, <4 x i32> %0) {
;
entry:
  br i1 false, label %write_buffer_8x8.exit631, label %if.then.i25.i.i478

if.then.i25.i.i478:                               ; preds = %entry
  %vecinit3.i.i285.i326 = shufflevector <4 x i32> %0, <4 x i32> zeroinitializer, <4 x i32> zeroinitializer
  %add.i312.1.i430 = add <4 x i32> %vecinit3.i.i285.i326, splat (i32 1)
  %1 = ashr <4 x i32> %0, splat (i32 1)
  %2 = ashr <4 x i32> %add.i312.1.i430, splat (i32 1)
  %3 = ashr <4 x i32> %0, splat (i32 1)
  %add.i330.1.i448 = add <4 x i32> %2, %3
  %sub.i348.1.i473 = sub <4 x i32> %1, %add.i330.1.i448
  %4 = ashr <4 x i32> %0, splat (i32 1)
  %5 = ashr <4 x i32> %0, splat (i32 1)
  %add.i327.1.i445 = add <4 x i32> %4, %5
  %add.i344.1.i465 = add <4 x i32> %1, %add.i327.1.i445
  %6 = ashr <4 x i32> %0, splat (i32 1)
  %7 = ashr <4 x i32> %0, splat (i32 1)
  %add.i343.1.i463 = add <4 x i32> %6, %7
  %8 = ashr <4 x i32> %0, splat (i32 1)
  %add.i342.1.i461 = add <4 x i32> %8, %7
  %add.i312.i363 = add <4 x i32> %vecinit3.i.i285.i326, splat (i32 1)
  %9 = ashr <4 x i32> %0, splat (i32 1)
  %10 = ashr <4 x i32> %add.i312.i363, splat (i32 1)
  %11 = ashr <4 x i32> %0, splat (i32 1)
  %add.i330.i381 = add <4 x i32> %10, %11
  %sub.i348.i405 = sub <4 x i32> %9, %add.i330.i381
  %12 = ashr <4 x i32> %0, splat (i32 1)
  %add.i.i349 = add <4 x i32> %0, splat (i32 1)
  %13 = ashr <4 x i32> %add.i.i349, splat (i32 1)
  %add.i327.i378 = add <4 x i32> %12, %13
  %add.i344.i397 = add <4 x i32> %9, %add.i327.i378
  %14 = ashr <4 x i32> %0, splat (i32 1)
  %15 = ashr <4 x i32> %0, splat (i32 1)
  %add.i343.i395 = add <4 x i32> %14, %15
  %16 = ashr <4 x i32> %0, splat (i32 1)
  %add.i342.i393 = add <4 x i32> %16, %15
  br label %write_buffer_8x8.exit631

write_buffer_8x8.exit631:                         ; preds = %if.then.i25.i.i478, %entry
  %out.sroa.152.1.in = phi <4 x i32> [ %sub.i348.1.i473, %if.then.i25.i.i478 ], [ zeroinitializer, %entry ]
  %out.sroa.142.1.in = phi <4 x i32> [ %sub.i348.i405, %if.then.i25.i.i478 ], [ zeroinitializer, %entry ]
  %17 = phi <4 x i32> [ %add.i344.1.i465, %if.then.i25.i.i478 ], [ zeroinitializer, %entry ]
  %18 = phi <4 x i32> [ %add.i344.i397, %if.then.i25.i.i478 ], [ zeroinitializer, %entry ]
  %19 = phi <4 x i32> [ %add.i343.1.i463, %if.then.i25.i.i478 ], [ zeroinitializer, %entry ]
  %20 = phi <4 x i32> [ %add.i343.i395, %if.then.i25.i.i478 ], [ zeroinitializer, %entry ]
  %21 = phi <4 x i32> [ %add.i342.1.i461, %if.then.i25.i.i478 ], [ zeroinitializer, %entry ]
  %22 = phi <4 x i32> [ %add.i342.i393, %if.then.i25.i.i478 ], [ zeroinitializer, %entry ]
  %23 = tail call <8 x i16> @llvm.x86.sse41.packusdw(<4 x i32> %22, <4 x i32> %21)
  store <8 x i16> %23, ptr %input, align 1
  %24 = tail call <8 x i16> @llvm.x86.sse41.packusdw(<4 x i32> %20, <4 x i32> %19)
  store <8 x i16> %24, ptr %output_r, align 1
  %25 = tail call <8 x i16> @llvm.x86.sse41.packusdw(<4 x i32> %18, <4 x i32> %17)
  store <8 x i16> %25, ptr %input, align 1
  %26 = tail call <8 x i16> @llvm.x86.sse41.packusdw(<4 x i32> %out.sroa.142.1.in, <4 x i32> %out.sroa.152.1.in)
  ret <8 x i16> %26
}

declare <8 x i16> @llvm.x86.sse41.packusdw(<4 x i32>, <4 x i32>)