[llvm] [LV] Handle chained selects/blends when creating new rdx chain. (PR #199443)

Thurston Dang via llvm-commits llvm-commits at lists.llvm.org
Sun May 24 16:38:25 PDT 2026


thurstond wrote:

One of the buildbots is failing after this commit (https://lab.llvm.org/staging/#/builders/7/builds/1736/steps/9/logs/stdio).

Since it's past midnight in London right now, I'll revert first to get the bot back to green.

```
CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines,time_macros /usr/bin/ccache /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang++ -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/lib/Target/AMDGPU -I/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/AMDGPU -I/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/include -I/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/include -nostdinc++ -isystem /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/libcxx_install_msan/include -isystem /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/libcxx_install_msan/include/c++/v1 -fsanitize=memory -Wl,--rpath=/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/libcxx_install_msan/lib -L/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/libcxx_install_msan/lib -w -stdlib=libc++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fno-omit-frame-pointer -gline-tables-only -fsanitize=memory -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17 -fvisibility=hidden -UNDEBUG -fno-exceptions -funwind-tables -fno-rtti -MD -MT lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIMachineScheduler.cpp.o -MF lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIMachineScheduler.cpp.o.d -o lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIMachineScheduler.cpp.o -c /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp
clang++: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/Support/Casting.h:572: decltype(auto) llvm::cast(From *) [To = llvm::VPInstruction, From = llvm::VPSingleDefRecipe]: 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, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang++ -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/lib/Target/AMDGPU -I/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/AMDGPU -I/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/include -I/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/include -nostdinc++ -isystem /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/libcxx_install_msan/include -isystem /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/libcxx_install_msan/include/c++/v1 -fsanitize=memory -Wl,--rpath=/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/libcxx_install_msan/lib -L/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/libcxx_install_msan/lib -w -stdlib=libc++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fno-omit-frame-pointer -gline-tables-only -fsanitize=memory -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17 -fvisibility=hidden -UNDEBUG -fno-exceptions -funwind-tables -fno-rtti -MD -MT lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIMachineScheduler.cpp.o -MF lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIMachineScheduler.cpp.o.d -fcolor-diagnostics -c -o lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIMachineScheduler.cpp.o /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp
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;check-exit-count>,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,mergeicmps,expand-memcmp,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 "/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp"
4.	Running pass "loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>" on function "_ZN4llvm22SIScheduleBlockCreator22createBlocksForVariantENS_30SISchedulerBlockCreatorVariantE"
 #0 0x0000af42e4891874 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x9561874)
 #1 0x0000af42e488ec3c llvm::sys::RunSignalHandlers() (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x955ec3c)
 #2 0x0000af42e48905b8 llvm::sys::CleanupOnSignal(unsigned long) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x95605b8)
 #3 0x0000af42e47ef674 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #4 0x0000eb31827fea20 (linux-vdso.so.1+0xa20)
 #5 0x0000eb31821de13c (/usr/lib/aarch64-linux-gnu/libc.so.6+0x8e13c)
 #6 0x0000eb31821885fc raise (/usr/lib/aarch64-linux-gnu/libc.so.6+0x385fc)
 #7 0x0000eb3182172720 abort (/usr/lib/aarch64-linux-gnu/libc.so.6+0x22720)
 #8 0x0000eb31821d0a98 (/usr/lib/aarch64-linux-gnu/libc.so.6+0x80a98)
 #9 0x0000eb31821810d8 __assert_fail (/usr/lib/aarch64-linux-gnu/libc.so.6+0x310d8)
#10 0x0000af42e4ace630 std::_Function_handler<void (llvm::VPSingleDefRecipe*), llvm::LoopVectorizationPlanner::addReductionResultComputation(std::unique_ptr<llvm::VPlan, std::default_delete<llvm::VPlan>>&, llvm::VPRecipeBuilder&, llvm::ElementCount)::$_1>::_M_invoke(std::_Any_data const&, llvm::VPSingleDefRecipe*&&) LoopVectorize.cpp:0:0
#11 0x0000af42e4ace364 std::_Function_handler<void (llvm::VPSingleDefRecipe*), llvm::LoopVectorizationPlanner::addReductionResultComputation(std::unique_ptr<llvm::VPlan, std::default_delete<llvm::VPlan>>&, llvm::VPRecipeBuilder&, llvm::ElementCount)::$_1>::_M_invoke(std::_Any_data const&, llvm::VPSingleDefRecipe*&&) LoopVectorize.cpp:0:0
#12 0x0000af42e4a9dea0 llvm::LoopVectorizationPlanner::addReductionResultComputation(std::unique_ptr<llvm::VPlan, std::default_delete<llvm::VPlan>>&, llvm::VPRecipeBuilder&, llvm::ElementCount) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x976dea0)
#13 0x0000af42e4a9c620 llvm::LoopVectorizationPlanner::tryToBuildVPlan(std::unique_ptr<llvm::VPlan, std::default_delete<llvm::VPlan>>, llvm::VFRange&) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x976c620)
#14 0x0000af42e4a929e8 llvm::LoopVectorizationPlanner::buildVPlans(llvm::ElementCount, llvm::ElementCount) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x97629e8)
#15 0x0000af42e4a92374 llvm::LoopVectorizationPlanner::plan(llvm::ElementCount, unsigned int) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x9762374)
#16 0x0000af42e4aa01d8 llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x97701d8)
#17 0x0000af42e4aa95f4 llvm::LoopVectorizePass::runImpl(llvm::Function&) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x97795f4)
#18 0x0000af42e4aa9e84 llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x9779e84)
#19 0x0000af42e4259f20 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x8f29f20)
#20 0x0000af42e425df1c llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x8f2df1c)
#21 0x0000af42e425902c llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x8f2902c)
#22 0x0000af42e517a0ac (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
#23 0x0000af42e5171bac 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*) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x9e41bac)
#24 0x0000af42e5182c98 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x9e52c98)
#25 0x0000af42e6a41038 clang::ParseAST(clang::Sema&, bool, bool) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0xb711038)
#26 0x0000af42e567382c clang::FrontendAction::Execute() (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0xa34382c)
#27 0x0000af42e55e52ec clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0xa2b52ec)
#28 0x0000af42e576539c clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0xa43539c)
#29 0x0000af42e1c6b7c4 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x693b7c4)
#30 0x0000af42e1c67e64 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#31 0x0000af42e1c6a068 int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::$_0>(long, llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#32 0x0000af42e544e6d0 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::$_0>(long) Job.cpp:0:0
#33 0x0000af42e47ef370 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x94bf370)
#34 0x0000af42e544de0c clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0xa11de0c)
#35 0x0000af42e54122e4 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0xa0e22e4)
#36 0x0000af42e54124d4 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0xa0e24d4)
#37 0x0000af42e542c894 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0xa0fc894)
#38 0x0000af42e1c67210 clang_main(int, char**, llvm::ToolContext const&) (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x6937210)
#39 0x0000af42e1c76720 main (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x6946720)
#40 0x0000eb3182172f1c (/usr/lib/aarch64-linux-gnu/libc.so.6+0x22f1c)
#41 0x0000eb318217305c __libc_start_main (/usr/lib/aarch64-linux-gnu/libc.so.6+0x2305c)
#42 0x0000af42e1c657b0 _start (/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build0/bin/clang+++0x69357b0)
```


https://github.com/llvm/llvm-project/pull/199443


More information about the llvm-commits mailing list