From: John McCall Date: Tue, 16 Nov 2010 05:45:35 +0000 (+0000) Subject: Teach complex compound assignment IR-generation that the RHS of X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=641ca7d01441c34566756744838abb8faf1356aa;p=clang Teach complex compound assignment IR-generation that the RHS of a compound assignment is always already in the computation type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119330 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExprComplex.cpp b/lib/CodeGen/CGExprComplex.cpp index 25824260aa..5697a8b1bf 100644 --- a/lib/CodeGen/CGExprComplex.cpp +++ b/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.