[cfe-commits] r119330 - /cfe/trunk/lib/CodeGen/CGExprComplex.cpp

John McCall rjmccall at apple.com
Mon Nov 15 21:45:35 PST 2010


Author: rjmccall
Date: Mon Nov 15 23:45:35 2010
New Revision: 119330

URL: http://llvm.org/viewvc/llvm-project?rev=119330&view=rev
Log:
Teach complex compound assignment IR-generation that the RHS of
a compound assignment is always already in the computation type.


Modified:
    cfe/trunk/lib/CodeGen/CGExprComplex.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprComplex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprComplex.cpp?rev=119330&r1=119329&r2=119330&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprComplex.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprComplex.cpp Mon Nov 15 23:45:35 2010
@@ -540,10 +540,14 @@
 
   // 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.





More information about the cfe-commits mailing list