[llvm-branch-commits] [cfe-branch] r81357 - in /cfe/branches/Apple/Dib/lib/CodeGen: CGExprComplex.cpp CGExprScalar.cpp
Mike Stump
mrs at apple.com
Wed Sep 9 10:45:30 PDT 2009
Author: mrs
Date: Wed Sep 9 12:45:30 2009
New Revision: 81357
URL: http://llvm.org/viewvc/llvm-project?rev=81357&view=rev
Log:
Backport mainline fix for Radar 7107398.
Modified:
cfe/branches/Apple/Dib/lib/CodeGen/CGExprComplex.cpp
cfe/branches/Apple/Dib/lib/CodeGen/CGExprScalar.cpp
Modified: cfe/branches/Apple/Dib/lib/CodeGen/CGExprComplex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/CodeGen/CGExprComplex.cpp?rev=81357&r1=81356&r2=81357&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/lib/CodeGen/CGExprComplex.cpp (original)
+++ cfe/branches/Apple/Dib/lib/CodeGen/CGExprComplex.cpp Wed Sep 9 12:45:30 2009
@@ -433,20 +433,23 @@
EmitCompoundAssign(const CompoundAssignOperator *E,
ComplexPairTy (ComplexExprEmitter::*Func)(const BinOpInfo&)){
QualType LHSTy = E->getLHS()->getType(), RHSTy = E->getRHS()->getType();
-
- // Load the LHS and RHS operands.
- LValue LHSLV = CGF.EmitLValue(E->getLHS());
BinOpInfo OpInfo;
+
+ // Load the RHS and LHS operands.
+ // __block variables need to have the rhs evaluated first, plus this should
+ // improve codegen a little. It is possible for the RHS to be complex or
+ // scalar.
OpInfo.Ty = E->getComputationResultType();
+ OpInfo.RHS = EmitCast(E->getRHS(), OpInfo.Ty);
+
+ LValue LHSLV = CGF.EmitLValue(E->getLHS());
+
// We know the LHS is a complex lvalue.
- OpInfo.LHS = EmitLoadOfComplex(LHSLV.getAddress(), LHSLV.isVolatileQualified());
- OpInfo.LHS = EmitComplexToComplexCast(OpInfo.LHS, LHSTy, OpInfo.Ty);
+ OpInfo.LHS=EmitLoadOfComplex(LHSLV.getAddress(), LHSLV.isVolatileQualified());
+ OpInfo.LHS=EmitComplexToComplexCast(OpInfo.LHS, LHSTy, OpInfo.Ty);
- // It is possible for the RHS to be complex or scalar.
- OpInfo.RHS = EmitCast(E->getRHS(), OpInfo.Ty);
-
// Expand the binary operator.
ComplexPairTy Result = (this->*Func)(OpInfo);
Modified: cfe/branches/Apple/Dib/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/CodeGen/CGExprScalar.cpp?rev=81357&r1=81356&r2=81357&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/branches/Apple/Dib/lib/CodeGen/CGExprScalar.cpp Wed Sep 9 12:45:30 2009
@@ -798,15 +798,16 @@
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);
@@ -1184,8 +1185,10 @@
}
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]
More information about the llvm-branch-commits
mailing list