]> granicus.if.org Git - clang/commitdiff
Temporary fix for a performance problem Eli spotted. The APValue representation
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 10 Nov 2011 03:30:42 +0000 (03:30 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 10 Nov 2011 03:30:42 +0000 (03:30 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144260 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ExprConstant.cpp

index aa949907eb11b83d1dd22cc49311ee9504fa25d5..f2e3d36d751b675f30349a367cbcbf63269f7a8e 100644 (file)
@@ -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;