summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-11-10 03:30:42 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-11-10 03:30:42 +0000
commit5686e75a7b4983d5018b1be5de1ec37ae2133e11 (patch)
treeb523e8117b6731ff7025b34d6ed4e333c4aa00d2 /clang/lib/AST/ExprConstant.cpp
parent16d2320c97db924440c153139d5db0fd56479c17 (diff)
downloadbcm5719-llvm-5686e75a7b4983d5018b1be5de1ec37ae2133e11.tar.gz
bcm5719-llvm-5686e75a7b4983d5018b1be5de1ec37ae2133e11.zip
Temporary fix for a performance problem Eli spotted. The APValue representation
is currently too inefficient to allow us to use it for array initializers, but fortunately we usually don't yet need to evaluate such initializers. llvm-svn: 144260
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index aa949907eb1..f2e3d36d751 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -3391,6 +3391,12 @@ static bool EvaluateConstantExpression(APValue &Result, EvalInfo &Info,
/// in Result. If this expression is a glvalue, an lvalue-to-rvalue conversion
/// will be applied to the result.
bool Expr::EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx) const {
+ // FIXME: Evaluating initializers for large arrays can cause performance
+ // problems, and we don't use such values yet. Once we have a more efficient
+ // array representation, this should be reinstated, and used by CodeGen.
+ if (isRValue() && getType()->isArrayType())
+ return false;
+
EvalInfo Info(Ctx, Result);
CCValue Value;
OpenPOWER on IntegriCloud