https://github.com/ilya-biryukov created https://github.com/llvm/llvm-project/pull/157662
At some point the call to static `TypedefType::Profile` inside `ASTContext::getTypedefType` got out-of-sync with the non-static `TypedefType::Profile`. This seem to cause some bad performance patterns with `FoldingSet` and are seeing 10x increases in compile times in certain scenarios. After this commit, the compile times go back to normal. This commit does not include tests or benchmarks because we want to land this ASAP to unbreak our deployment. I will work on adding asserts, tests or benchmarks in a follow-up. >From 4cc4469e78fb5c4578c4e228b0897ba6cb162a07 Mon Sep 17 00:00:00 2001 From: Ilya Biryukov <[email protected]> Date: Tue, 9 Sep 2025 14:46:02 +0200 Subject: [PATCH] [AST] Match the FoldingSetNodeID computed before and after creating TypedefType At some point the call to static `TypedefType::Profile` inside `ASTContext::getTypedefType` got out-of-sync with the non-static `TypedefType::Profile`. This seem to cause some bad performance patterns with `FoldingSet` and are seeing 10x increases in compile times in certain scenarios. After this commit, the compile times go back to normal. This commit does not include tests or benchmarks because we want to land this ASAP to unbreak our deployment. I will work on adding asserts, tests or benchmarks in a follow-up. --- clang/lib/AST/ASTContext.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index dca05b41aee77..c04de4e132739 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -5316,7 +5316,8 @@ ASTContext::getTypedefType(ElaboratedTypeKeyword Keyword, } llvm::FoldingSetNodeID ID; - TypedefType::Profile(ID, Keyword, Qualifier, Decl, UnderlyingType); + TypedefType::Profile(ID, Keyword, Qualifier, Decl, + *TypeMatchesDeclOrNone ? QualType() : UnderlyingType); void *InsertPos = nullptr; if (FoldingSetPlaceholder<TypedefType> *Placeholder = _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
