From b3d5e2f181269656c1b2dbc09eab1f449d5074aa Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Thu, 27 Jan 2011 23:22:05 +0000 Subject: When producing IR for a lvalue-to-rvalue cast *as an lvalue*, only non-class prvalues actually require the realization of a temporary. For everything else, we already have an lvalue (or class prvalue) in the subexpression. Note: we're missing some move elision in this case. I'll tackle that next. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124453 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index ca80d3dd38..8bac4c0b02 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -1772,11 +1772,12 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { } case CK_NoOp: - if (!E->getSubExpr()->isRValue() || E->getType()->isRecordType()) + case CK_LValueToRValue: + if (!E->getSubExpr()->Classify(getContext()).isPRValue() + || E->getType()->isRecordType()) return EmitLValue(E->getSubExpr()); // Fall through to synthesize a temporary. - case CK_LValueToRValue: case CK_BitCast: case CK_ArrayToPointerDecay: case CK_FunctionToPointerDecay: -- cgit v1.2.3