summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-05-21 21:05:15 +0000
committerMike Stump <mrs@apple.com>2009-05-21 21:05:15 +0000
commitaed08f9929e20265acb91d14d5b5db87b86c8bf1 (patch)
tree7cd20e2e4a7733763965d6143b67671408ea78db /clang/lib/CodeGen
parent8c46fec43d1fe7acf9f21d3bc9e2c4c01ff34085 (diff)
downloadbcm5719-llvm-aed08f9929e20265acb91d14d5b5db87b86c8bf1.tar.gz
bcm5719-llvm-aed08f9929e20265acb91d14d5b5db87b86c8bf1.zip
Fixup blocks codegen for { __block i; i = rhs(); }, we want the rhs
evaluated first. This can also improve codegen just a bit as we might have another register to play with for the evaluation of the rhs. llvm-svn: 72226
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGExprScalar.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index 05573d6aec3..01dd94c274b 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -1189,8 +1189,10 @@ Value *ScalarExprEmitter::EmitCompare(const BinaryOperator *E,unsigned UICmpOpc,
}
Value *ScalarExprEmitter::VisitBinAssign(const BinaryOperator *E) {
- LValue LHS = EmitLValue(E->getLHS());
+ // __block variables need to have the rhs evaluated first, plus
+ // this should improve codegen just a little.
Value *RHS = Visit(E->getRHS());
+ LValue LHS = EmitLValue(E->getLHS());
// Store the value into the LHS. Bit-fields are handled specially
// because the result is altered by the store, i.e., [C99 6.5.16p1]
OpenPOWER on IntegriCloud