diff options
| author | John McCall <rjmccall@apple.com> | 2010-11-16 05:45:35 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-11-16 05:45:35 +0000 |
| commit | 641ca7d01441c34566756744838abb8faf1356aa (patch) | |
| tree | b8fb51d160276a7093851c335bad8c1708106725 /lib/CodeGen/CGExprComplex.cpp | |
| parent | 1c23e91ef66688d20868b6bab3b5589a119eb603 (diff) | |
| download | clang-641ca7d01441c34566756744838abb8faf1356aa.tar.gz clang-641ca7d01441c34566756744838abb8faf1356aa.tar.bz2 clang-641ca7d01441c34566756744838abb8faf1356aa.tar.xz | |
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
Diffstat (limited to 'lib/CodeGen/CGExprComplex.cpp')
| -rw-r--r-- | lib/CodeGen/CGExprComplex.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
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. |
