aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprScalar.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-05-22 19:07:20 +0000
committerMike Stump <mrs@apple.com>2009-05-22 19:07:20 +0000
commitcc0442fa28e5d1f403f820dcdee49911c3e622a9 (patch)
treedf7f7a5e4575f020176ecbc97e2702d28b36734e /lib/CodeGen/CGExprScalar.cpp
parente027a4b2399e9b0acfe0f77220c66bbe369067ee (diff)
Fixup codegen for __block int i; i += rhs();. Should also slightly
improve codegen in some cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72273 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r--lib/CodeGen/CGExprScalar.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 01dd94c274..8cd84ecdb4 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -803,15 +803,16 @@ Value *ScalarExprEmitter::EmitCompoundAssign(const CompoundAssignOperator *E,
return llvm::UndefValue::get(CGF.ConvertType(E->getType()));
}
+ // Emit the RHS first. __block variables need to have the rhs evaluated
+ // first, plus this should improve codegen a little.
+ OpInfo.RHS = Visit(E->getRHS());
+ OpInfo.Ty = E->getComputationResultType();
+ OpInfo.E = E;
// Load/convert the LHS.
LValue LHSLV = EmitLValue(E->getLHS());
OpInfo.LHS = EmitLoadOfLValue(LHSLV, LHSTy);
OpInfo.LHS = EmitScalarConversion(OpInfo.LHS, LHSTy,
E->getComputationLHSType());
- // Emit the RHS.
- OpInfo.RHS = Visit(E->getRHS());
- OpInfo.Ty = E->getComputationResultType();
- OpInfo.E = E;
// Expand the binary operator.
Value *Result = (this->*Func)(OpInfo);