[llvm] [SLP]Remove operands upon marking instruction for deletion. (PR #97409)
Alexander Kornienko via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 12 04:14:34 PDT 2024
alexfh wrote:
We also see crashes after this commit. None of the fixes resolve the crashes, the crashes reproduce at ToT as of now. No assertion failures are visible, just a crash with this call stack:
```
#3 0x000055bfbd8e5211 llvm::CastInst::isNoopCast(llvm::DataLayout const&) const (bin/clang+0x80e5211)
#4 0x000055bfbd2d5bce llvm::salvageDebugInfoImpl(llvm::Instruction&, unsigned long, llvm::SmallVectorImpl<unsigned long>&, llvm::SmallVectorImpl<llvm::Value*>&) (bin/clang+0x7ad5bce)
#5 0x000055bfbd2d57f8 llvm::salvageDebugInfoForDbgValues(llvm::Instruction&, llvm::ArrayRef<llvm::DbgVariableIntrinsic*>, llvm::ArrayRef<llvm::DbgVariableRecord*>) (bin/clang+0x7ad57f8)
#6 0x000055bfbd2cecb9 llvm::salvageDebugInfo(llvm::Instruction&) (bin/clang+0x7acecb9)
#7 0x000055bfbce8d5b4 void llvm::slpvectorizer::BoUpSLP::removeInstructionsAndOperands<llvm::Instruction>(llvm::ArrayRef<llvm::Instruction*>) (bin/clang+0x768d5b4)
#8 0x000055bfbce8ba2b llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::MapVector<llvm::Value*, llvm::SmallVector<llvm::Instruction*, 2u>, llvm::DenseMap<llvm::Value*, unsigned int, llvm::DenseMapInfo<llvm::Value*, void>, llvm::detail::DenseMapPair<llvm::Value*, unsigned int>>, llvm::SmallVector<std::__u::pair<llvm::Value*, llvm::SmallVector<llvm::Instruction*, 2u>>, 0u>> const&, llvm::SmallVectorImpl<std::__u::pair<llvm::Value*, llvm::Value*>>&, llvm::Instruction*) (bin/clang+0x768ba2b)
#9 0x000055bfbce88dd7 llvm::slpvectorizer::BoUpSLP::vectorizeTree() (bin/clang+0x7688dd7)
#10 0x000055bfbce98eb2 llvm::SLPVectorizerPass::vectorizeStoreChain(llvm::ArrayRef<llvm::Value*>, llvm::slpvectorizer::BoUpSLP&, unsigned int, unsigned int, unsigned int&) (bin/clang+0x7698eb2)
#11 0x000055bfbce9a8d9 llvm::SLPVectorizerPass::vectorizeStores(llvm::ArrayRef<llvm::StoreInst*>, llvm::slpvectorizer::BoUpSLP&, llvm::DenseSet<std::__u::tuple<llvm::Value*, llvm::Value*, llvm::Value*, llvm::Value*, unsigned int>, llvm::DenseMapInfo<std::__u::tuple<llvm::Value*, llvm::Value*, llvm::Value*, llvm::Value*, unsigned int>, void>>&)::$_0::operator()(std::__u::set<std::__u::pair<unsigned int, int>, llvm::SLPVectorizerPass::vectorizeStores(llvm::ArrayRef<llvm::StoreInst*>, llvm::slpvectorizer::BoUpSLP&, llvm::DenseSet<std::__u::tuple<llvm::Value*, llvm::Value*, llvm::Value*, llvm::Value*, unsigned int>, llvm::DenseMapInfo<std::__u::tuple<llvm::Value*, llvm::Value*, llvm::Value*, llvm::Value*, unsigned int>, void>>&)::StoreDistCompare, std::__u::allocator<std::__u::pair<unsigned int, int>>> const&) const (bin/clang+0x769a8d9)
#12 0x000055bfbce99d1b llvm::SLPVectorizerPass::vectorizeStores(llvm::ArrayRef<llvm::StoreInst*>, llvm::slpvectorizer::BoUpSLP&, llvm::DenseSet<std::__u::tuple<llvm::Value*, llvm::Value*, llvm::Value*, llvm::Value*, unsigned int>, llvm::DenseMapInfo<std::__u::tuple<llvm::Value*, llvm::Value*, llvm::Value*, llvm::Value*, unsigned int>, void>>&) (bin/clang+0x7699d1b)
#13 0x000055bfbce95c02 llvm::SLPVectorizerPass::vectorizeStoreChains(llvm::slpvectorizer::BoUpSLP&) (bin/clang+0x7695c02)
#14 0x000055bfbce9487d llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) (bin/clang+0x769487d)
#15 0x000055bfbce94395 llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (bin/clang+0x7694395)
#16 0x000055bfbc1c1e92 llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (bin/clang+0x69c1e92)
#17 0x000055bfbd934a29 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (bin/clang+0x8134a29)
#18 0x000055bfb8dd1552 llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (bin/clang+0x35d1552)
#19 0x000055bfbd9371c9 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (bin/clang+0x81371c9)
#20 0x000055bfb8dcc352 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (bin/clang+0x35cc352)
#21 0x000055bfbd933e89 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (bin/clang+0x8133e89)
#22 0x000055bfb8f747f1 llvm::lto::opt(llvm::lto::Config const&, llvm::TargetMachine*, unsigned int, llvm::Module&, bool, llvm::ModuleSummaryIndex*, llvm::ModuleSummaryIndex const*, std::__u::vector<unsigned char, std::__u::allocator<unsigned char>> const&) (bin/clang+0x37747f1)
#23 0x000055bfb8f76685 llvm::lto::thinBackend(llvm::lto::Config const&, unsigned int, std::__u::function<llvm::Expected<std::__u::unique_ptr<llvm::CachedFileStream, std::__u::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, llvm::Module&, llvm::ModuleSummaryIndex const&, llvm::DenseMap<llvm::StringRef, std::__u::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__u::hash<unsigned long>, std::__u::equal_to<unsigned long>, std::__u::allocator<std::__u::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind>>>, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__u::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__u::hash<unsigned long>, std::__u::equal_to<unsigned long>, std::__u::allocator<std::__u::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind>>>>> const&, llvm::DenseMap<unsigned long, llvm::GlobalValueSummary*, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::GlobalValueSummary*>> const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int>>, llvm::SmallVector<std::__u::pair<llvm::StringRef, llvm::BitcodeModule>, 0u>>*, std::__u::vector<unsigned char, std::__u::allocator<unsigned char>> const&)::$_0::operator()(llvm::Module&, llvm::TargetMachine*, std::__u::unique_ptr<llvm::ToolOutputFile, std::__u::default_delete<llvm::ToolOutputFile>>) const (bin/clang+0x3776685)
#24 0x000055bfb8f76516 llvm::lto::thinBackend(llvm::lto::Config const&, unsigned int, std::__u::function<llvm::Expected<std::__u::unique_ptr<llvm::CachedFileStream, std::__u::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, llvm::Module&, llvm::ModuleSummaryIndex const&, llvm::DenseMap<llvm::StringRef, std::__u::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__u::hash<unsigned long>, std::__u::equal_to<unsigned long>, std::__u::allocator<std::__u::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind>>>, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__u::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__u::hash<unsigned long>, std::__u::equal_to<unsigned long>, std::__u::allocator<std::__u::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind>>>>> const&, llvm::DenseMap<unsigned long, llvm::GlobalValueSummary*, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::GlobalValueSummary*>> const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int>>, llvm::SmallVector<std::__u::pair<llvm::StringRef, llvm::BitcodeModule>, 0u>>*, std::__u::vector<unsigned char, std::__u::allocator<unsigned char>> const&) (bin/clang+0x3776516)
#25 0x000055bfb8dc1279 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::__u::unique_ptr<llvm::raw_pwrite_stream, std::__u::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (bin/clang+0x35c1279)
#26 0x000055bfb8a91173 clang::CodeGenAction::ExecuteAction() (bin/clang+0x3291173)
#27 0x000055bfb964b15a clang::FrontendAction::Execute() (bin/clang+0x3e4b15a)
#28 0x000055bfb95c2484 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (bin/clang+0x3dc2484)
#29 0x000055bfb87573cf clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (bin/clang+0x2f573cf)
#30 0x000055bfb874c526 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (bin/clang+0x2f4c526)
```
https://github.com/llvm/llvm-project/pull/97409
More information about the llvm-commits
mailing list