From fa8edb11e1bda901ccf248f5fad63238f61ff3c6 Mon Sep 17 00:00:00 2001 From: John McCall Date: Tue, 16 Nov 2010 05:45:35 +0000 Subject: Teach complex compound assignment IR-generation that the RHS of a compound assignment is always already in the computation type. llvm-svn: 119330 --- clang/lib/CodeGen/CGExprComplex.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'clang/lib/CodeGen/CGExprComplex.cpp') diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp index 2582426..5697a8b 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. -- cgit v1.1