From: Eli Friedman Date: Fri, 6 Sep 2013 01:13:30 +0000 (+0000) Subject: Reduce stack usage of TreeTransform. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1ac6c93b7fc1dc29cc847079342172c2cc23c143;p=clang Reduce stack usage of TreeTransform. Without this patch, TreeTransform::TransformExpr uses a ridiculous amount of stack space (around 5000 bytes). Preventing inlining brings the stack usage down to something sane. On a testcase I have, on my computer, this allows changing -ftemplate-depth from 210 to around 750 before we crash. I'm not sure I should commit the testcase, though: I don't want to cause test failures on platforms with less stack space available. . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190114 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 165a1aff3b..cd0ffdd8e9 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -598,14 +598,19 @@ public: ExprResult TransformDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E, bool IsAddressOfOperand); +// FIXME: We use LLVM_ATTRIBUTE_NOINLINE because inlining causes a ridiculous +// amount of stack usage with clang. #define STMT(Node, Parent) \ + LLVM_ATTRIBUTE_NOINLINE \ StmtResult Transform##Node(Node *S); #define EXPR(Node, Parent) \ + LLVM_ATTRIBUTE_NOINLINE \ ExprResult Transform##Node(Node *E); #define ABSTRACT_STMT(Stmt) #include "clang/AST/StmtNodes.inc" #define OPENMP_CLAUSE(Name, Class) \ + LLVM_ATTRIBUTE_NOINLINE \ OMPClause *Transform ## Class(Class *S); #include "clang/Basic/OpenMPKinds.def"