[clang] a69a406 - [AST] Match the FoldingSetNodeID computed before and after creating TypedefType (#157662)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 9 06:17:26 PDT 2025
Author: Ilya Biryukov
Date: 2025-09-09T15:17:23+02:00
New Revision: a69a406776dd6f475843d882ff0d67d17695b76e
URL: https://github.com/llvm/llvm-project/commit/a69a406776dd6f475843d882ff0d67d17695b76e
DIFF: https://github.com/llvm/llvm-project/commit/a69a406776dd6f475843d882ff0d67d17695b76e.diff
LOG: [AST] Match the FoldingSetNodeID computed before and after creating TypedefType (#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.
Added:
Modified:
clang/lib/AST/ASTContext.cpp
Removed:
################################################################################
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 =
More information about the cfe-commits
mailing list