[llvm] [SLP]Do not require external uses for roots and single use for other instructions in computeMinimumValueSizes. (PR #72679)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 03:08:08 PST 2024


alexey-bataev wrote:

> Hi @alexey-bataev The following starts crashing with this patch (also the re-applied one)
> 
> ```
> opt -passes=slp-vectorizer bbi-90943.ll -o /dev/nul
> ```
> 
> It crashes with
> 
> ```
> opt: ../lib/IR/Instructions.cpp:2956: static llvm::BinaryOperator *llvm::BinaryOperator::Create(llvm::Instruction::BinaryOps, llvm::Value *, llvm::Value *, const llvm::Twine &, llvm::Instruction *): Assertion `S1->getType() == S2->getType() && "Cannot create binary operator with two operands of differing type!"' failed.
> PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
> Stack dump:
> 0.	Program arguments: ../../main-github/llvm/build-all/bin/opt -passes=slp-vectorizer bbi-90943.ll -o /dev/null
>  #0 0x00005652edde3e67 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (../../main-github/llvm/build-all/bin/opt+0x63a8e67)
>  #1 0x00005652edde19be llvm::sys::RunSignalHandlers() (../../main-github/llvm/build-all/bin/opt+0x63a69be)
>  #2 0x00005652edde452f SignalHandler(int) (../../main-github/llvm/build-all/bin/opt+0x63a952f)
>  #3 0x00007f6c391a4630 __restore_rt (/lib64/libpthread.so.0+0xf630)
>  #4 0x00007f6c368eb387 raise (/lib64/libc.so.6+0x36387)
>  #5 0x00007f6c368eca78 abort (/lib64/libc.so.6+0x37a78)
>  #6 0x00007f6c368e41a6 __assert_fail_base (/lib64/libc.so.6+0x2f1a6)
>  #7 0x00007f6c368e4252 (/lib64/libc.so.6+0x2f252)
>  #8 0x00005652ed7b39e0 llvm::BinaryOperator::Create(llvm::Instruction::BinaryOps, llvm::Value*, llvm::Value*, llvm::Twine const&, llvm::BasicBlock*) (../../main-github/llvm/build-all/bin/opt+0x5d789e0)
>  #9 0x00005652ee4d11a0 (anonymous namespace)::HorizontalReduction::tryToReduce(llvm::slpvectorizer::BoUpSLP&, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo const&) (../../main-github/llvm/build-all/bin/opt+0x6a961a0)
> #10 0x00005652ee4b4f18 llvm::SLPVectorizerPass::vectorizeHorReduction(llvm::PHINode*, llvm::Instruction*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, llvm::TargetTransformInfo*, llvm::SmallVectorImpl<llvm::WeakTrackingVH>&) (../../main-github/llvm/build-all/bin/opt+0x6a79f18)
> #11 0x00005652ee4e0250 bool llvm::SLPVectorizerPass::vectorizeCmpInsts<std::reverse_iterator<llvm::CmpInst* const*> >(llvm::iterator_range<std::reverse_iterator<llvm::CmpInst* const*> >, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (../../main-github/llvm/build-all/bin/opt+0x6aa5250)
> #12 0x00005652ee4b6917 llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&)::$_146::operator()(bool) const (../../main-github/llvm/build-all/bin/opt+0x6a7b917)
> #13 0x00005652ee4abf76 llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (../../main-github/llvm/build-all/bin/opt+0x6a70f76)
> #14 0x00005652ee4a98d0 llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) (../../main-github/llvm/build-all/bin/opt+0x6a6e8d0)
> #15 0x00005652ee4a8e51 llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (../../main-github/llvm/build-all/bin/opt+0x6a6de51)
> #16 0x00005652edffb7fd llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (../../main-github/llvm/build-all/bin/opt+0x65c07fd)
> #17 0x00005652ed815634 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (../../main-github/llvm/build-all/bin/opt+0x5dda634)
> #18 0x00005652ebbcbe3d llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (../../main-github/llvm/build-all/bin/opt+0x4190e3d)
> #19 0x00005652ed819a1e llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (../../main-github/llvm/build-all/bin/opt+0x5ddea1e)
> #20 0x00005652ebbcbbdd llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (../../main-github/llvm/build-all/bin/opt+0x4190bdd)
> #21 0x00005652ed814756 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (../../main-github/llvm/build-all/bin/opt+0x5dd9756)
> #22 0x00005652eb6e3d43 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) (../../main-github/llvm/build-all/bin/opt+0x3ca8d43)
> #23 0x00005652eb6f2444 main (../../main-github/llvm/build-all/bin/opt+0x3cb7444)
> #24 0x00007f6c368d7555 __libc_start_main (/lib64/libc.so.6+0x22555)
> #25 0x00005652eb6ddee9 _start (../../main-github/llvm/build-all/bin/opt+0x3ca2ee9)
> Abort (core dumped)
> ```
> 
> [bbi-90943.ll.gz](https://github.com/llvm/llvm-project/files/13915910/bbi-90943.ll.gz)

Thanks, will fix it ASAP

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


More information about the llvm-commits mailing list