diff options
author | Manuel Klimek <klimek@google.com> | 2015-03-25 23:18:30 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2015-03-25 23:18:30 +0000 |
commit | 093b2d48b46919e4323f4217ab13a4ec46c8ac0a (patch) | |
tree | 024fdaddcb5ed0a1a95eef6455afd3de89d2e8f1 /clang/lib/Serialization/ASTReaderDecl.cpp | |
parent | 70c1665d83861e35ddd5c3a1b665992e1738b7e2 (diff) | |
download | bcm5719-llvm-093b2d48b46919e4323f4217ab13a4ec46c8ac0a.tar.gz bcm5719-llvm-093b2d48b46919e4323f4217ab13a4ec46c8ac0a.zip |
Keep track of canonical decls in Redeclarable.
More than 2x speedup on modules builds with large redecl chains.
Roughly 15-20% speedup on non-modules builds for very large TUs.
Between 2-3% cost in memory on large TUs.
llvm-svn: 233228
Diffstat (limited to 'clang/lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index d384f3d46e8..10de9f754de 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -2106,6 +2106,7 @@ ASTDeclReader::VisitRedeclarable(Redeclarable<T> *D) { // which is the one that matters and mark the real previous DeclID to be // loaded & attached later on. D->RedeclLink = Redeclarable<T>::PreviousDeclLink(FirstDecl); + D->First = FirstDecl->getCanonicalDecl(); } // Note that this declaration has been deserialized. @@ -2209,6 +2210,7 @@ void ASTDeclReader::mergeRedeclarable(Redeclarable<T> *DBase, T *Existing, // of the existing declaration, so that this declaration has the // appropriate canonical declaration. D->RedeclLink = Redeclarable<T>::PreviousDeclLink(ExistingCanon); + D->First = ExistingCanon; // When we merge a namespace, update its pointer to the first namespace. // We cannot have loaded any redeclarations of this declaration yet, so @@ -2828,6 +2830,7 @@ void ASTDeclReader::attachPreviousDeclImpl(ASTReader &Reader, Redeclarable<DeclT> *D, Decl *Previous, Decl *Canon) { D->RedeclLink.setPrevious(cast<DeclT>(Previous)); + D->First = cast<DeclT>(Previous)->First; } namespace clang { template<> @@ -2838,6 +2841,7 @@ void ASTDeclReader::attachPreviousDeclImpl(ASTReader &Reader, FunctionDecl *PrevFD = cast<FunctionDecl>(Previous); FD->RedeclLink.setPrevious(PrevFD); + FD->First = PrevFD->First; // If the previous declaration is an inline function declaration, then this // declaration is too. |