[cfe-commits] r144260 - /cfe/trunk/lib/AST/ExprConstant.cpp

Richard Smith richard-llvm at metafoo.co.uk
Wed Nov 9 19:30:42 PST 2011


Author: rsmith
Date: Wed Nov  9 21:30:42 2011
New Revision: 144260

URL: http://llvm.org/viewvc/llvm-project?rev=144260&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/AST/ExprConstant.cpp

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=144260&r1=144259&r2=144260&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Wed Nov  9 21:30:42 2011
@@ -3391,6 +3391,12 @@
 /// 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;





More information about the cfe-commits mailing list