]> granicus.if.org Git - clang/commitdiff
we already test for exact type matches early, so we don't have to do
authorChris Lattner <sabre@nondot.org>
Fri, 4 Jan 2008 23:20:56 +0000 (23:20 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 4 Jan 2008 23:20:56 +0000 (23:20 +0000)
it explicitly for vectors.  This allows us to unnest some code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45600 91177308-0d34-0410-b5e6-96231b3b80d8

Sema/SemaExpr.cpp

index 087fb95d002207bdca8edf5bda8b22047b709655..6661cfb8cbf7e8a535915b4ee91c2e77069fabb6 100644 (file)
@@ -1111,24 +1111,21 @@ Sema::CheckAssignmentConstraints(QualType lhsType, QualType rhsType) {
         if (LV->getElementType().getTypePtr() == rhsType.getTypePtr())
           return Compatible;
       }
-      if (!getLangOptions().LaxVectorConversions) {
-        if (lhsType != rhsType)
-          return Incompatible;
-      } else {
-        if (lhsType->isVectorType() && rhsType->isVectorType()) {
-          // If LHS and RHS are both integer or both floating point types, and
-          // the total vector length is the same, allow the conversion.  This is
-          // a bitcast; no bits are changed but the result type is different.
-          if ((lhsType->isIntegerType() && rhsType->isIntegerType()) ||
-              (lhsType->isRealFloatingType() && 
-               rhsType->isRealFloatingType())) {
-            if (Context.getTypeSize(lhsType, SourceLocation()) == 
-                Context.getTypeSize(rhsType, SourceLocation()))
-              return Compatible;
-          }
+      
+      if (getLangOptions().LaxVectorConversions &&
+          lhsType->isVectorType() && rhsType->isVectorType()) {
+        // If LHS and RHS are both integer or both floating point types, and
+        // the total vector length is the same, allow the conversion.  This is
+        // a bitcast; no bits are changed but the result type is different.
+        if ((lhsType->isIntegerType() && rhsType->isIntegerType()) ||
+            (lhsType->isRealFloatingType() && 
+             rhsType->isRealFloatingType())) {
+          if (Context.getTypeSize(lhsType, SourceLocation()) == 
+              Context.getTypeSize(rhsType, SourceLocation()))
+            return Compatible;
         }
-        return Incompatible;
       }
+      return Incompatible;
     }      
     return Compatible;
   }