r190114 - Reduce stack usage of TreeTransform.
Eli Friedman
eli.friedman at gmail.com
Thu Sep 5 18:13:30 PDT 2013
Author: efriedma
Date: Thu Sep 5 20:13:30 2013
New Revision: 190114
URL: http://llvm.org/viewvc/llvm-project?rev=190114&view=rev
Log:
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.
<rdar://problem/14098189>.
Modified:
cfe/trunk/lib/Sema/TreeTransform.h
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=190114&r1=190113&r2=190114&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Thu Sep 5 20:13:30 2013
@@ -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"
More information about the cfe-commits
mailing list