Skip to content

Commit a69a406

Browse files
[AST] Match the FoldingSetNodeID computed before and after creating TypedefType (llvm#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.
1 parent 7d60680 commit a69a406

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/lib/AST/ASTContext.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5316,7 +5316,8 @@ ASTContext::getTypedefType(ElaboratedTypeKeyword Keyword,
53165316
}
53175317

53185318
llvm::FoldingSetNodeID ID;
5319-
TypedefType::Profile(ID, Keyword, Qualifier, Decl, UnderlyingType);
5319+
TypedefType::Profile(ID, Keyword, Qualifier, Decl,
5320+
*TypeMatchesDeclOrNone ? QualType() : UnderlyingType);
53205321

53215322
void *InsertPos = nullptr;
53225323
if (FoldingSetPlaceholder<TypedefType> *Placeholder =

0 commit comments

Comments
 (0)