[llvm] [SLP]Vectorize gathered loads (PR #107461)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 4 08:37:28 PDT 2024
alexey-bataev wrote:
> Hi @alexey-bataev
>
> The following starts crashing with this patch: `opt -passes=slp-vectorizer bbi-99793.ll -o /dev/null` (I've run llvm-reduce but the input is unfortunately still quite large)
>
> It crashes with
>
> ```
> opt: ../lib/Transforms/Vectorize/SLPVectorizer.cpp:7568: void llvm::slpvectorizer::BoUpSLP::buildTree_rec(ArrayRef<llvm::Value *>, unsigned int, const llvm::slpvectorizer::BoUpSLP::EdgeInfo &): Assertion `(allConstant(VL) || allSameType(VL)) && "Invalid types!"' failed.
> PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
> Stack dump:
> 0. Program arguments: build-all/bin/opt -passes=slp-vectorizer bbi-99793.ll -o /dev/null
> 1. Running pass "function(slp-vectorizer)" on module "bbi-99793.ll"
> 2. Running pass "slp-vectorizer" on function "test_structcopy_14"
> #0 0x00005562edfca907 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (build-all/bin/opt+0x422b907)
> #1 0x00005562edfc83ee llvm::sys::RunSignalHandlers() (build-all/bin/opt+0x42293ee)
> #2 0x00005562edfcb12f SignalHandler(int) Signals.cpp:0:0
> #3 0x00007f3e3e628cf0 __restore_rt (/lib64/libpthread.so.0+0x12cf0)
> #4 0x00007f3e3c1e1acf raise (/lib64/libc.so.6+0x4eacf)
> #5 0x00007f3e3c1b4ea5 abort (/lib64/libc.so.6+0x21ea5)
> #6 0x00007f3e3c1b4d79 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x21d79)
> #7 0x00007f3e3c1da426 (/lib64/libc.so.6+0x47426)
> #8 0x00005562ef8e84b6 llvm::slpvectorizer::BoUpSLP::buildTree_rec(llvm::ArrayRef<llvm::Value*>, unsigned int, llvm::slpvectorizer::BoUpSLP::EdgeInfo const&) (build-all/bin/opt+0x5b494b6)
> #9 0x00005562ef8e9fcd llvm::slpvectorizer::BoUpSLP::tryToVectorizeGatheredLoads(llvm::ArrayRef<llvm::SmallVector<std::pair<llvm::LoadInst*, int>, 3u>>)::$_41::operator()(llvm::ArrayRef<llvm::SmallVector<std::pair<llvm::LoadInst*, int>, 3u>>, bool) const SLPVectorizer.cpp:0:0
> #10 0x00005562ef8e8a2b llvm::slpvectorizer::BoUpSLP::tryToVectorizeGatheredLoads(llvm::ArrayRef<llvm::SmallVector<std::pair<llvm::LoadInst*, int>, 3u>>) (build-all/bin/opt+0x5b49a2b)
> #11 0x00005562ef8f84ca llvm::slpvectorizer::BoUpSLP::transformNodes() (build-all/bin/opt+0x5b594ca)
> #12 0x00005562ef96153b (anonymous namespace)::HorizontalReduction::tryToReduce(llvm::slpvectorizer::BoUpSLP&, llvm::DataLayout const&, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo const&) SLPVectorizer.cpp:0:0
> #13 0x00005562ef93b1a8 llvm::SLPVectorizerPass::vectorizeHorReduction(llvm::PHINode*, llvm::Instruction*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, llvm::TargetTransformInfo*, llvm::SmallVectorImpl<llvm::WeakTrackingVH>&) (build-all/bin/opt+0x5b9c1a8)
> #14 0x00005562ef93b58b llvm::SLPVectorizerPass::vectorizeRootInstruction(llvm::PHINode*, llvm::Instruction*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, llvm::TargetTransformInfo*) (build-all/bin/opt+0x5b9c58b)
> #15 0x00005562ef93025d llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (build-all/bin/opt+0x5b9125d)
> #16 0x00005562ef92d1b0 llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) (build-all/bin/opt+0x5b8e1b0)
> #17 0x00005562ef92c805 llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (build-all/bin/opt+0x5b8d805)
> #18 0x00005562ef381e7d llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) PassBuilderPipelines.cpp:0:0
> #19 0x00005562ee1d51da llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (build-all/bin/opt+0x44361da)
> #20 0x00005562ef37a1ed llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) PassBuilderPipelines.cpp:0:0
> #21 0x00005562ee1d9ca1 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (build-all/bin/opt+0x443aca1)
> #22 0x00005562ef373d8d llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) PassBuilderPipelines.cpp:0:0
> #23 0x00005562ee1d3f1a llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (build-all/bin/opt+0x4434f1a)
> #24 0x00005562ef31df5b 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) (build-all/bin/opt+0x557ef5b)
> #25 0x00005562edf91f7d optMain (build-all/bin/opt+0x41f2f7d)
> #26 0x00007f3e3c1cdd85 __libc_start_main (/lib64/libc.so.6+0x3ad85)
> #27 0x00005562edf8baee _start (build-all/bin/opt+0x41ecaee)
> Abort (core dumped)
> ```
>
> [bbi-99793.ll.gz](https://github.com/user-attachments/files/17254626/bbi-99793.ll.gz)
Must be fixed in d991e054529a805019d67769afd602ff878496f7
https://github.com/llvm/llvm-project/pull/107461
More information about the llvm-commits
mailing list