summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprScalar.cpp
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
commit99459b67daa0a49af7c5e5e93324f6ca815c0e6a (patch)
tree617f9620bc2ef0cb1950075babede4ccbe1e653b /lib/CodeGen/CGExprScalar.cpp
parent636bed1b8185099ef40a4f7fd192fc4242b385a4 (diff)
downloadclang-99459b67daa0a49af7c5e5e93324f6ca815c0e6a.tar.gz
clang-99459b67daa0a49af7c5e5e93324f6ca815c0e6a.tar.bz2
clang-99459b67daa0a49af7c5e5e93324f6ca815c0e6a.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72226 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r--lib/CodeGen/CGExprScalar.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 05573d6aec..01dd94c274 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/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]