alexfh wrote:
@cmc-rep this commit causes Clang timeouts compiling some of our code (specifically, compilation time growth from ~20s to more than 15 minutes, after which I gave up waiting, so I can't say whether it's an infinite loop or a superlinear algorithm).
I'll try to produce a test case, but for now maybe the perf report can give you some clues at what's happening:
```
- 99.66% 0.00% clang clang [.] main ▒
main ▒
- clang_main(int, char**, llvm::ToolContext const&) ▒
- 99.66% ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) ▒
- 99.66% cc1_main(llvm::ArrayRef<char const*>, char const*, void*) ▒
- 99.66% clang::ExecuteCompilerInvocation(clang::CompilerInstance*) ▒
- clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) ▒
- 99.66% clang::FrontendAction::Execute() ▒
- 99.66% clang::ParseAST(clang::Sema&, bool, bool) ▒
- 97.11% clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) ▒
- 97.11% clang::emitBackendOutput(clang::CompilerInstance&, clang::CodeGenOptions&, 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*) ▒
- 97.08% llvm::legacy::PassManagerImpl::run(llvm::Module&) ▒
llvm::FPPassManager::runOnModule(llvm::Module&) ▒
- llvm::FPPassManager::runOnFunction(llvm::Function&) ▒
- 97.06% (anonymous namespace)::LoadStoreVectorizerLegacyPass::runOnFunction(llvm::Function&) ▒
- (anonymous namespace)::Vectorizer::run() ▒
- 97.06% (anonymous namespace)::Vectorizer::runOnChain(llvm::SmallVector<(anonymous namespace)::ChainElem, 1u>&) ▒
- 97.06% llvm::ShuffleVectorInst::ShuffleVectorInst(llvm::Value*, llvm::Value*, llvm::ArrayRef<int>, llvm::Twine const&, llvm::InsertPosition) ▒
llvm::VectorType::get(llvm::Type*, llvm::ElementCount) ▒
std::__u::pair<llvm::detail::DenseMapPair<std::__u::pair<llvm::Type*, llvm::ElementCount>, llvm::VectorType*>*, bool> llvm::DenseMapBase<llvm::DenseMap<std::__u::pair<llvm::Type*, llvm::ElementCount>, llvm::VectorType*, llvm::DenseMapInfo<std::__u::pair<llvm::Type*, llvm::ElementCount>, void>, llvm::detail::DenseMapPair<std::__u::pair<llvm::Type*, llvm::ElementCount>, llvm::VectorType*> >, std::__u::pair<llvm::Type*, llvm::ElementCount>, llvm::VectorType*, llvm::DenseMapInfo<std::__u::pair<llvm::Type*, llvm::ElementCount>, void>, llvm::detail::DenseMapPair<std::__u::pair<llvm::Type*, llvm::ElementCount>, llvm::VectorType*> >::lookupOrInsertIntoBucket<std::__u::pair<llvm::Type*, llvm::ElementCount>>(std::__u::pair<llvm::Type*, llvm::ElementCount>&&) ▒
+ 2.52% clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) ▒
```
https://github.com/llvm/llvm-project/pull/168135