diff options
author | Mike Stump <mrs@apple.com> | 2009-05-22 19:07:20 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-05-22 19:07:20 +0000 |
commit | c63428b1921395bd06dbb8226eab833a0b2ce52a (patch) | |
tree | e0d933dc34be3edc82e0a0b78cf914e66f98001f /clang/lib/CodeGen/CGExprScalar.cpp | |
parent | adeeb052adb5d7411df25c23cb6eb05bcbc986bb (diff) | |
download | bcm5719-llvm-c63428b1921395bd06dbb8226eab833a0b2ce52a.tar.gz bcm5719-llvm-c63428b1921395bd06dbb8226eab833a0b2ce52a.zip |
Fixup codegen for __block int i; i += rhs();. Should also slightly
improve codegen in some cases.
llvm-svn: 72273
Diffstat (limited to 'clang/lib/CodeGen/CGExprScalar.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 01dd94c274b..8cd84ecdb45 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/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); |