summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprComplex.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-11-16 05:45:35 +0000
committerJohn McCall <rjmccall@apple.com>2010-11-16 05:45:35 +0000
commitfa8edb11e1bda901ccf248f5fad63238f61ff3c6 (patch)
treec51e757742b2a4864cae89ed9ffb4a8fea3d2372 /clang/lib/CodeGen/CGExprComplex.cpp
parentef5c6d02f54ee66cbe467e7de6fc38a274ebe943 (diff)
downloadbcm5719-llvm-fa8edb11e1bda901ccf248f5fad63238f61ff3c6.tar.gz
bcm5719-llvm-fa8edb11e1bda901ccf248f5fad63238f61ff3c6.zip
Teach complex compound assignment IR-generation that the RHS of
a compound assignment is always already in the computation type. llvm-svn: 119330
Diffstat (limited to 'clang/lib/CodeGen/CGExprComplex.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprComplex.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp
index 25824260aa4..5697a8b1bf4 100644
--- a/clang/lib/CodeGen/CGExprComplex.cpp
+++ b/clang/lib/CodeGen/CGExprComplex.cpp
@@ -540,10 +540,14 @@ EmitCompoundAssign(const CompoundAssignOperator *E,
// 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.
+ // improve codegen a little.
OpInfo.Ty = E->getComputationResultType();
- OpInfo.RHS = EmitCast(CK_Unknown, E->getRHS(), OpInfo.Ty);
+
+ // The RHS should have been converted to the computation type.
+ assert(OpInfo.Ty->isAnyComplexType());
+ assert(CGF.getContext().hasSameUnqualifiedType(OpInfo.Ty,
+ E->getRHS()->getType()));
+ OpInfo.RHS = Visit(E->getRHS());
LValue LHS = CGF.EmitLValue(E->getLHS());
// We know the LHS is a complex lvalue.
OpenPOWER on IntegriCloud