[cfe-commits] r120633 - /cfe/trunk/lib/Sema/SemaExpr.cpp

Bob Wilson bob.wilson at apple.com
Wed Dec 1 16:25:15 PST 2010


Author: bwilson
Date: Wed Dec  1 18:25:15 2010
New Revision: 120633

URL: http://llvm.org/viewvc/llvm-project?rev=120633&view=rev
Log:
Swap order of checking for compatible vector types.
Check for compatible gcc, Altivec and Neon vectors before handling the
lax-vector-conversions case.  Otherwise there is no way to avoid the
warnings from -Wvector-conversions.

Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=120633&r1=120632&r2=120633&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Dec  1 18:25:15 2010
@@ -5461,6 +5461,13 @@
 
   if (lhsType->isVectorType() || rhsType->isVectorType()) {
     if (lhsType->isVectorType() && rhsType->isVectorType()) {
+      // Allow assignments of an AltiVec vector type to an equivalent GCC
+      // vector type and vice versa
+      if (Context.areCompatibleVectorTypes(lhsType, rhsType)) {
+        Kind = CK_BitCast;
+        return Compatible;
+      }
+
       // If we are allowing lax vector conversions, and LHS and RHS are both
       // vectors, the total size only needs to be the same. This is a bitcast;
       // no bits are changed but the result type is different.
@@ -5469,13 +5476,6 @@
         Kind = CK_BitCast;
         return IncompatibleVectors;
       }
-
-      // Allow assignments of an AltiVec vector type to an equivalent GCC
-      // vector type and vice versa
-      if (Context.areCompatibleVectorTypes(lhsType, rhsType)) {
-        Kind = CK_BitCast;
-        return Compatible;
-      }
     }
     return Incompatible;
   }





More information about the cfe-commits mailing list