Canonicalize parameter and return types before computing ABI info.  Eliminates
a common source of oddities and, in theory, removes some redundant ABI
computations.  Also fixes a miscompile I introduced yesterday by refactoring
some code and causing a slightly different code path to be taken that
didn't perform *parameter* type canonicalization, just normal type
canonicalization;  this in turn caused a bit of ABI code to misfire because
it was looking for 'double' or 'float' but received 'const float'.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97030 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
index f1cbc56..f4ec914 100644
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/lib/CodeGen/TargetInfo.cpp
@@ -972,12 +972,11 @@
       return (Ty->isPromotableIntegerType() ?
               ABIArgInfo::getExtend() : ABIArgInfo::getDirect());
   } else if (CoerceTo == llvm::Type::getDoubleTy(CoerceTo->getContext())) {
-    // FIXME: It would probably be better to make CGFunctionInfo only map using
-    // canonical types than to canonize here.
-    QualType CTy = Context.getCanonicalType(Ty);
+    assert(Ty.isCanonical() && "should always have a canonical type here");
+    assert(!Ty.hasQualifiers() && "should never have a qualified type here");
 
     // Float and double end up in a single SSE reg.
-    if (CTy == Context.FloatTy || CTy == Context.DoubleTy)
+    if (Ty == Context.FloatTy || Ty == Context.DoubleTy)
       return ABIArgInfo::getDirect();
 
   }