remove uses of QualType::getCanonicalType() from codegen for PR2189


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54107 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExprComplex.cpp b/lib/CodeGen/CGExprComplex.cpp
index 6bf0d48..2ea0a48 100644
--- a/lib/CodeGen/CGExprComplex.cpp
+++ b/lib/CodeGen/CGExprComplex.cpp
@@ -259,8 +259,8 @@
                                                            QualType SrcType,
                                                            QualType DestType) {
   // Get the src/dest element type.
-  SrcType = cast<ComplexType>(SrcType.getCanonicalType())->getElementType();
-  DestType = cast<ComplexType>(DestType.getCanonicalType())->getElementType();
+  SrcType = SrcType->getAsComplexType()->getElementType();
+  DestType = DestType->getAsComplexType()->getElementType();
 
   // C99 6.3.1.6: When a value of complextype is converted to another
   // complex type, both the real and imaginary parts followthe conversion
@@ -282,7 +282,7 @@
   llvm::Value *Elt = CGF.EmitScalarExpr(Op);
 
   // Convert the input element to the element type of the complex.
-  DestTy = cast<ComplexType>(DestTy.getCanonicalType())->getElementType();
+  DestTy = DestTy->getAsComplexType()->getElementType();
   Elt = CGF.EmitScalarConversion(Elt, Op->getType(), DestTy);
   
   // Return (realval, 0).
@@ -437,8 +437,9 @@
 }
 
 ComplexPairTy ComplexExprEmitter::VisitBinAssign(const BinaryOperator *E) {
-  assert(E->getLHS()->getType().getCanonicalType() ==
-         E->getRHS()->getType().getCanonicalType() && "Invalid assignment");
+  assert(CGF.getContext().getCanonicalType(E->getLHS()->getType()) ==
+         CGF.getContext().getCanonicalType(E->getRHS()->getType()) &&
+         "Invalid assignment");
   // Emit the RHS.
   ComplexPairTy Val = Visit(E->getRHS());