[llvm] [SLP]Allow bitcast/bswap based reductions for types, larger than the total strided size (PR #184018)

antoine moynault via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 15 23:40:35 PDT 2026


antmox wrote:

Hi, it looks like this also causes clang-aarch64-sve-vls-2stage bot to fail:
https://lab.llvm.org/buildbot/#/builders/4/builds/11974
https://lab.llvm.org/buildbot/#/builders/4/builds/12032

```
FAILED: lib/Demangle/CMakeFiles/LLVMDemangle.dir/ItaniumDemangle.cpp.o 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/stage1.install/bin/clang++ -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -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/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/stage2/lib/Demangle -I/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/llvm/llvm/lib/Demangle -I/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/stage2/include -I/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/llvm/llvm/include -mcpu=neoverse-512tvb -msve-vector-bits=256 -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 -fdiagnostics-color -ffunction-sections -fdata-sections -Xclang -fno-pch-timestamp -O3 -DNDEBUG -std=c++17 -UNDEBUG -fno-exceptions -funwind-tables -fno-rtti -MD -MT lib/Demangle/CMakeFiles/LLVMDemangle.dir/ItaniumDemangle.cpp.o -MF lib/Demangle/CMakeFiles/LLVMDemangle.dir/ItaniumDemangle.cpp.o.d -o lib/Demangle/CMakeFiles/LLVMDemangle.dir/ItaniumDemangle.cpp.o -c /home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/llvm/llvm/lib/Demangle/ItaniumDemangle.cpp
clang++: /home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/llvm/llvm/include/llvm/Support/Casting.h:572: decltype(auto) llvm::cast(From *) [To = llvm::VectorType, 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, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/stage1.install/bin/clang++ -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -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/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/stage2/lib/Demangle -I/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/llvm/llvm/lib/Demangle -I/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/stage2/include -I/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/llvm/llvm/include -mcpu=neoverse-512tvb -msve-vector-bits=256 -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 -fdiagnostics-color -ffunction-sections -fdata-sections -Xclang -fno-pch-timestamp -O3 -DNDEBUG -std=c++17 -UNDEBUG -fno-exceptions -funwind-tables -fno-rtti -MD -MT lib/Demangle/CMakeFiles/LLVMDemangle.dir/ItaniumDemangle.cpp.o -MF lib/Demangle/CMakeFiles/LLVMDemangle.dir/ItaniumDemangle.cpp.o.d -o lib/Demangle/CMakeFiles/LLVMDemangle.dir/ItaniumDemangle.cpp.o -c /home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/llvm/llvm/lib/Demangle/ItaniumDemangle.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>,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 "/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/llvm/llvm/lib/Demangle/ItaniumDemangle.cpp"
4.	Running pass "slp-vectorizer" on function "_ZNK4llvm16itanium_demangle16FloatLiteralImplIeE9printLeftERNS0_12OutputBufferE"
 #0 0x0000ca1903942fe0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/stage1.install/bin/clang+++0x92a2fe0)
 #1 0x0000ca1903940538 llvm::sys::RunSignalHandlers() (/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/stage1.install/bin/clang+++0x92a0538)
 #2 0x0000ca1903941e30 llvm::sys::CleanupOnSignal(unsigned long) (/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/stage1.install/bin/clang+++0x92a1e30)
 #3 0x0000ca190389fce4 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #4 0x0000f101eefe2a60 (linux-vdso.so.1+0xa60)
 #5 0x0000f101eeb52008 __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #6 0x0000f101eeb0a83c gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #7 0x0000f101eeaf7134 abort ./stdlib/abort.c:81:7
 #8 0x0000f101eeb04114 __assert_fail_base ./assert/assert.c:91:7
 #9 0x0000f101eeb0418c (/lib/aarch64-linux-gnu/libc.so.6+0x3418c)
#10 0x0000ca1904edf9e4 llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::SmallDenseSet<llvm::Value*, 4u, llvm::DenseMapInfo<llvm::Value*, void>> const&, llvm::Instruction*, llvm::ArrayRef<std::tuple<llvm::WeakTrackingVH, unsigned int, bool, bool>>) (/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/stage1.install/bin/clang+++0xa83f9e4)
#11 0x0000ca1904f3f38c (anonymous namespace)::HorizontalReduction::tryToReduce(llvm::slpvectorizer::BoUpSLP&, llvm::DataLayout const&, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo const&, llvm::AssumptionCache*, llvm::DominatorTree&) SLPVectorizer.cpp:0:0
#12 0x0000ca1904ef9a4c llvm::SLPVectorizerPass::vectorizeHorReduction(llvm::PHINode*, llvm::Instruction*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, llvm::SmallVectorImpl<llvm::WeakTrackingVH>&) (/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/stage1.install/bin/clang+++0xa859a4c)
#13 0x0000ca1904f5318c bool llvm::SLPVectorizerPass::vectorizeCmpInsts<std::reverse_iterator<llvm::CmpInst* const*>>(llvm::iterator_range<std::reverse_iterator<llvm::CmpInst* const*>>, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/stage1.install/bin/clang+++0xa8b318c)
#14 0x0000ca1904efcf60 llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&)::$_4::operator()(bool) const SLPVectorizer.cpp:0:0
#15 0x0000ca1904ef042c llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/stage1.install/bin/clang+++0xa85042c)
#16 0x0000ca1904eed5b4 llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) (/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/stage1.install/bin/clang+++0xa84d5b4)
#17 0x0000ca1904eecaf0 llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/stage1.install/bin/clang+++0xa84caf0)
#18 0x0000ca1903308a84 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/tcwg-buildbot/worker/clang-aarch64-sve-vls-2stage/stage1.install/bin/clang+++0x8c68a84)

```

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


More information about the llvm-commits mailing list