summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2010-12-12 21:36:11 +0000
committerChandler Carruth <chandlerc@gmail.com>2010-12-12 21:36:11 +0000
commit88bfa5ea510efcc8d58897fecb41836a25c46be5 (patch)
treea4017b17809a8e282264b500773e3fca02866713 /clang/lib/Sema/SemaDeclCXX.cpp
parent7d07a45fffca6e51fd353b5beed3db093c978f1a (diff)
downloadbcm5719-llvm-88bfa5ea510efcc8d58897fecb41836a25c46be5.tar.gz
bcm5719-llvm-88bfa5ea510efcc8d58897fecb41836a25c46be5.zip
Move the functionality to mark all vtables of key functions as used within
a translation unit to the ActOnEndOfTranslationUnit function instead of doing it at the start of DefineUsedVTables. The latter is now called *recursively* during template instantiation, which causes an absolutely insane number of walks of every record decl in the translation unit. After this patch, an extremely template instantiation heavy test case's compile time drops by 10x, and we see between 15% and 20% improvement in average compile times across a project. This is just recovering a regression, it doesn't make anything faster than it was several weeks ago. llvm-svn: 121644
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp14
1 files changed, 1 insertions, 13 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index be1979e26ed..4fc770eecfb 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -6895,21 +6895,9 @@ void Sema::MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class,
}
bool Sema::DefineUsedVTables() {
- // If any dynamic classes have their key function defined within
- // this translation unit, then those vtables are considered "used" and must
- // be emitted.
- for (unsigned I = 0, N = DynamicClasses.size(); I != N; ++I) {
- if (const CXXMethodDecl *KeyFunction
- = Context.getKeyFunction(DynamicClasses[I])) {
- const FunctionDecl *Definition = 0;
- if (KeyFunction->hasBody(Definition))
- MarkVTableUsed(Definition->getLocation(), DynamicClasses[I], true);
- }
- }
-
if (VTableUses.empty())
return false;
-
+
// Note: The VTableUses vector could grow as a result of marking
// the members of a class as "used", so we check the size each
// time through the loop and prefer indices (with are stable) to
OpenPOWER on IntegriCloud