[llvm] [SLP]Add support for strided loads. (PR #80310)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 08:12:59 PST 2024


alexey-bataev wrote:

> After this change, clang crashes on compiling the https://github.com/oneapi-src/oneDNN project.
> 
> UPDATE: [here](https://gist.github.com/hokein/9bf88e4d82cf83c3f3c81fa266ef2563) is a not-reduced test case.
> 
> Stacktrace:
> 
> ```
> 2.      Optimizer
>  #0 0x00005627dd41d6a8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) llvm-project/llvm/lib/Support/Unix/Signals.inc:723:13
>  #1 0x00005627dd41b7a0 llvm::sys::RunSignalHandlers() llvm-project/llvm/lib/Support/Signals.cpp:106:18
>  #2 0x00005627dd41dd48 SignalHandler(int) llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
>  #3 0x00007fd8fb05a510 (/lib/x86_64-linux-gnu/libc.so.6+0x3c510)
>  #4 0x00007fd8fb0a80fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
>  #5 0x00007fd8fb05a472 raise ./signal/../sysdeps/posix/raise.c:27:6
>  #6 0x00007fd8fb0444b2 abort ./stdlib/abort.c:81:7
>  #7 0x00007fd8fb0443d5 _nl_load_domain ./intl/loadmsgcat.c:1177:9
>  #8 0x00007fd8fb0533a2 (/lib/x86_64-linux-gnu/libc.so.6+0x353a2)
>  #9 0x00005627de99d150 llvm::isa_impl_cl<llvm::InsertElementInst, llvm::Instruction const*>::doit(llvm::Instruction const*) llvm-project/llvm/include/llvm/Support/Casting.h:109:5
> #10 0x00005627de99d150 llvm::isa_impl_wrap<llvm::InsertElementInst, llvm::Instruction const*, llvm::Instruction const*>::doit(llvm::Instruction const* const&) llvm-project/llvm/include/llvm/Support/Casting.h:137:12
> #11 0x00005627de99d150 llvm::isa_impl_wrap<llvm::InsertElementInst, llvm::Instruction const* const, llvm::Instruction const*>::doit(llvm::Instruction const* const&) llvm-project/llvm/include/llvm/Support/Casting.h:127:12
> #12 0x00005627de99d150 llvm::CastIsPossible<llvm::InsertElementInst, llvm::Instruction const*, void>::isPossible(llvm::Instruction const* const&) llvm-project/llvm/include/llvm/Support/Casting.h:255:12
> #13 0x00005627de99d150 llvm::CastInfo<llvm::InsertElementInst, llvm::Instruction* const, void>::isPossible(llvm::Instruction* const&) llvm-project/llvm/include/llvm/Support/Casting.h:509:12
> #14 0x00005627de99d150 bool llvm::isa<llvm::InsertElementInst, llvm::Instruction*>(llvm::Instruction* const&) llvm-project/llvm/include/llvm/Support/Casting.h:549:10
> #15 0x00005627de99d150 bool llvm::isa<llvm::InsertElementInst, llvm::StoreInst, llvm::Instruction*>(llvm::Instruction* const&) llvm-project/llvm/include/llvm/Support/Casting.h:554:10
> #16 0x00005627de99d150 llvm::slpvectorizer::BoUpSLP::reorderTopToBottom() llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4609:13
> #17 0x00005627de9f8148 (anonymous namespace)::HorizontalReduction::tryToReduce(llvm::slpvectorizer::BoUpSLP&, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo const&) llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:14873:11
> #18 0x00005627de9dfe8e llvm::SLPVectorizerPass::vectorizeHorReduction(llvm::PHINode*, llvm::Instruction*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, llvm::TargetTransformInfo*, llvm::SmallVectorImpl<llvm::WeakTrackingVH>&)::$_1::operator()(llvm::Instruction*) const llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:15699:19
> #19 0x00005627de9dfe8e llvm::SLPVectorizerPass::vectorizeHorReduction(llvm::PHINode*, llvm::Instruction*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, llvm::TargetTransformInfo*, llvm::SmallVectorImpl<llvm::WeakTrackingVH>&) llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:15724:30
> #20 0x00005627de9e01d9 llvm::SLPVectorizerPass::vectorizeRootInstruction(llvm::PHINode*, llvm::Instruction*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, llvm::TargetTransformInfo*) llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:15759:14
> #21 0x00005627de9d81fd llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:16317:24
> #22 0x00005627de9d5fc0 llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:13528:13
> #23 0x00005627de9d58bf llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:13459:18
> #24 0x00005627de6cc5ed llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:5
> #25 0x00005627dcef2459 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) llvm-project/llvm/include/llvm/IR/PassManager.h:247:10
> #26 0x00005627db43affd llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:5
> #27 0x00005627dcef5e2e llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) llvm-project/llvm/lib/IR/PassManager.cpp:128:23
> #28 0x00005627db43ad9d llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:5
> #29 0x00005627dcef174b llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) llvm-project/llvm/include/llvm/IR/PassManager.h:247:10
> #30 0x00005627ddb51a67 llvm::SmallPtrSetImplBase::isSmall() const llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h:196:33
> #31 0x00005627ddb51a67 llvm::SmallPtrSetImplBase::~SmallPtrSetImplBase() llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h:84:10
> #32 0x00005627ddb51a67 llvm::PreservedAnalyses::~PreservedAnalyses() llvm-project/llvm/include/llvm/IR/Analysis.h:109:7
> #33 0x00005627ddb51a67 (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*) llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1102:5
> #34 0x00005627ddb48de8 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) llvm-project/clang/lib/CodeGen/BackendUtil.cpp:0:3
> #35 0x00005627ddb48de8 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, 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*) llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1329:13
> #36 0x00005627ddb6754a std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>::~unique_ptr() /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:403:6
> #37 0x00005627ddb6754a clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:379:3
> #38 0x00005627df5faab6 __gnu_cxx::__normal_iterator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>*, std::vector<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>, std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>>>>::__normal_iterator(std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>* const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_iterator.h:1077:20
> #39 0x00005627df5faab6 std::vector<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>, std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>>>::begin() /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:871:16
> #40 0x00005627df5faab6 void clang::finalize<std::vector<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>, std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>>>>(std::vector<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>, std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>>>&, clang::Sema const&) llvm-project/clang/include/clang/Sema/TemplateInstCallback.h:54:16
> #41 0x00005627df5faab6 clang::ParseAST(clang::Sema&, bool, bool) llvm-project/clang/lib/Parse/ParseAST.cpp:183:3
> #42 0x00005627ddf05230 clang::FrontendAction::Execute() llvm-project/clang/lib/Frontend/FrontendAction.cpp:1073:10
> #43 0x00005627dde7b6ad llvm::Error::getPtr() const llvm-project/llvm/include/llvm/Support/Error.h:276:42
> #44 0x00005627dde7b6ad llvm::Error::operator bool() llvm-project/llvm/include/llvm/Support/Error.h:239:16
> #45 0x00005627dde7b6ad clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1057:23
> ```

Thanks, will check it ASAP.

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


More information about the llvm-commits mailing list