Created attachment 23046 [details] bbi-37904.ll reproducer opt -loop-vectorize -S -o - bbi-37904.ll hits an assertion opt: ../lib/Transforms/Vectorize/VPRecipeBuilder.h:91: llvm::VPRecipeBase *llvm::VPRecipeBuilder::getRecipe(llvm::Instruction *): Assertion `Ingredient2Recipe[I] != nullptr && "Ingredient doesn't have a recipe"' failed. Stack dump: 0. Program arguments: build-all-builtins/bin/opt -loop-vectorize -S -o - bbi-37904.ll 1. Running pass 'Function Pass Manager' on module 'bbi-37904.ll'. 2. Running pass 'Loop Vectorization' on function '@g' #0 0x0000000003e7dcf4 PrintStackTraceSignalHandler(void*) (build-all-builtins/bin/opt+0x3e7dcf4) #1 0x0000000003e7b8be llvm::sys::RunSignalHandlers() (build-all-builtins/bin/opt+0x3e7b8be) #2 0x0000000003e7e0fc SignalHandler(int) (build-all-builtins/bin/opt+0x3e7e0fc) #3 0x00007fce53a1a890 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890) #4 0x00007fce524c3e97 raise /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0 #5 0x00007fce524c5801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0 #6 0x00007fce524b539a __assert_fail_base /build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0 #7 0x00007fce524b5412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412) #8 0x0000000003fcad96 llvm::VPRecipeBuilder::getRecipe(llvm::Instruction*) (build-all-builtins/bin/opt+0x3fcad96) #9 0x0000000003fc9483 llvm::LoopVectorizationPlanner::buildVPlanWithVPRecipes(llvm::VFRange&, llvm::SmallPtrSetImpl<llvm::Value*>&, llvm::SmallPtrSetImpl<llvm::Instruction*>&) (build-all-builtins/bin/opt+0x3fc9483) #10 0x0000000003fc36af llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(unsigned int, unsigned int) (build-all-builtins/bin/opt+0x3fc36af) #11 0x0000000003fc2f02 llvm::LoopVectorizationPlanner::plan(unsigned int) (build-all-builtins/bin/opt+0x3fc2f02) #12 0x0000000003fcdb56 llvm::LoopVectorizePass::processLoop(llvm::Loop*) (build-all-builtins/bin/opt+0x3fcdb56) #13 0x0000000003fd0b64 llvm::LoopVectorizePass::runImpl(llvm::Function&, llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::BlockFrequencyInfo&, llvm::TargetLibraryInfo*, llvm::DemandedBits&, llvm::AAResults&, llvm::AssumptionCache&, std::function<llvm::LoopAccessInfo const& (llvm::Loop&)>&, llvm::OptimizationRemarkEmitter&, llvm::ProfileSummaryInfo*) (build-all-builtins/bin/opt+0x3fd0b64) #14 0x0000000003fd5588 (anonymous namespace)::LoopVectorize::runOnFunction(llvm::Function&) (build-all-builtins/bin/opt+0x3fd5588) #15 0x00000000036fefd3 llvm::FPPassManager::runOnFunction(llvm::Function&) (build-all-builtins/bin/opt+0x36fefd3) #16 0x00000000036ff2b8 llvm::FPPassManager::runOnModule(llvm::Module&) (build-all-builtins/bin/opt+0x36ff2b8) #17 0x00000000036ff91d llvm::legacy::PassManagerImpl::run(llvm::Module&) (build-all-builtins/bin/opt+0x36ff91d) #18 0x0000000002095a93 main (build-all-builtins/bin/opt+0x2095a93) #19 0x00007fce524a6b97 __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0 #20 0x000000000207d02a _start (build-all-builtins/bin/opt+0x207d02a) Abort (core dumped) It starts failing with commit 9d24933f: Recommit f0c2a5a "[LV] Generalize conditions for sinking instrs for first order recurrences."
Proposed fix https://reviews.llvm.org/D73423
(In reply to Florian Hahn from comment #1) > Proposed fix https://reviews.llvm.org/D73423 Nice! I've verified that the crash I saw goes away with the fix, and I haven't seen any new failures with the (limited) testing I've done so far.
Fixed in https://reviews.llvm.org/rGa911fef3dd79 I think it would be good to pick this for 10.0, if possible.
(In reply to Florian Hahn from comment #3) > Fixed in https://reviews.llvm.org/rGa911fef3dd79 > > I think it would be good to pick this for 10.0, if possible. Cherry-picked in b0536b58c1b40ac946bb653d13a63e4372c2ca17