Index: include/clang/AST/ASTContext.h
===================================================================
--- include/clang/AST/ASTContext.h	(revision 107555)
+++ include/clang/AST/ASTContext.h	(working copy)
@@ -895,6 +895,11 @@
   ///
   Qualifiers::GC getObjCGCAttrKind(const QualType &Ty) const;
 
+  /// areCompatibleVectorTypes - Return true if the given vector types either
+  /// are of the same unqualified type or if one is GCC and other - equivalent
+  /// AltiVec vector type.
+  bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec);
+
   /// isObjCNSObjectType - Return true if this is an NSObject object with
   /// its NSObject attribute set.
   bool isObjCNSObjectType(QualType Ty) const;
Index: lib/AST/ASTContext.cpp
===================================================================
--- lib/AST/ASTContext.cpp	(revision 107555)
+++ lib/AST/ASTContext.cpp	(working copy)
@@ -1553,10 +1553,7 @@
   // If the element type isn't canonical, this won't be a canonical type either,
   // so fill in the canonical type field.
   QualType Canonical;
-  if (!vecType.isCanonical() || (AltiVecSpec == VectorType::AltiVec)) {
-    // pass VectorType::NotAltiVec for AltiVecSpec to make AltiVec canonical
-    // vector type (except 'vector bool ...' and 'vector Pixel') the same as
-    // the equivalent GCC vector types
+  if (!vecType.isCanonical()) {
     Canonical = getVectorType(getCanonicalType(vecType), NumElts,
       VectorType::NotAltiVec);
 
@@ -4159,6 +4156,28 @@
          LHS->getNumElements() == RHS->getNumElements();
 }
 
+bool ASTContext::areCompatibleVectorTypes(QualType FirstVec,
+                                          QualType SecondVec) {
+
+  assert(FirstVec->isVectorType() && SecondVec->isVectorType());
+
+  if (hasSameUnqualifiedType(FirstVec, SecondVec))
+    return true;
+
+  // AltiVec vectors types are identical to equivalent GCC vector types
+  const VectorType *First = FirstVec->getAs<VectorType>();
+  const VectorType *Second = SecondVec->getAs<VectorType>();
+  if ((((First->getAltiVecSpecific() == VectorType::AltiVec) &&
+        (Second->getAltiVecSpecific() == VectorType::NotAltiVec)) ||
+       ((First->getAltiVecSpecific() == VectorType::NotAltiVec) &&
+        (Second->getAltiVecSpecific() == VectorType::AltiVec))) &&
+      (First->getElementType() == Second->getElementType()) &&
+      (First->getNumElements() == Second->getNumElements()))
+    return true;
+
+  return false;
+}
+
 //===----------------------------------------------------------------------===//
 // ObjCQualifiedIdTypesAreCompatible - Compatibility testing for qualified id's.
 //===----------------------------------------------------------------------===//
Index: lib/CodeGen/CodeGenFunction.h
===================================================================
--- lib/CodeGen/CodeGenFunction.h	(revision 107555)
+++ lib/CodeGen/CodeGenFunction.h	(working copy)
@@ -1377,11 +1377,16 @@
         assert(Arg != ArgEnd && "Running over edge of argument list!");
         QualType ArgType = *I;
 
-        assert(getContext().getCanonicalType(ArgType.getNonReferenceType()).
-               getTypePtr() ==
-               getContext().getCanonicalType(Arg->getType()).getTypePtr() &&
-               "type mismatch in call argument!");
-
+        if (!ArgType.getNonReferenceType()->isVectorType() ||
+            !Arg->getType()->isVectorType() ||
+            !getContext().areCompatibleVectorTypes(
+                                      ArgType.getNonReferenceType(),
+                                      Arg->getType())) {
+          assert(getContext().getCanonicalType(ArgType.getNonReferenceType()).
+                 getTypePtr() ==
+                 getContext().getCanonicalType(Arg->getType()).getTypePtr() &&
+                 "type mismatch in call argument!");
+        }
         Args.push_back(std::make_pair(EmitCallArg(*Arg, ArgType),
                                       ArgType));
       }
Index: lib/Sema/SemaOverload.cpp
===================================================================
--- lib/Sema/SemaOverload.cpp	(revision 107555)
+++ lib/Sema/SemaOverload.cpp	(working copy)
@@ -834,7 +834,8 @@
     return false;
 
   // Identical types require no conversions.
-  if (Context.hasSameUnqualifiedType(FromType, ToType))
+  if (ToType->isVectorType() && FromType->isVectorType() &&
+      Context.areCompatibleVectorTypes(FromType, ToType))
     return false;
 
   // There are no conversions between extended vector types, only identity.
@@ -1087,6 +1088,13 @@
       FromType = ToType;
       CanonFrom = CanonTo;
     }
+
+    // identical GCC and AltiVec vectors have different canonical types
+    if (CanonFrom->isVectorType() && CanonTo->isVectorType() &&
+        Context.areCompatibleVectorTypes(CanonFrom, CanonTo)) {
+      FromType = ToType;
+      CanonFrom = CanonTo;
+    }
   }
   SCS.setToType(2, FromType);
 
Index: test/Parser/altivec.c
===================================================================
--- test/Parser/altivec.c	(revision 107555)
+++ test/Parser/altivec.c	(working copy)
@@ -19,7 +19,7 @@
 __vector __pixel vv_p;
 __vector pixel vv__p;
 __vector int vf__r();
-void vf__a(__vector int a);
+void vf__a(__vector int a) {};
 void vf__a2(int b, __vector int a);
 
 vector char v_c;
@@ -95,6 +95,7 @@
   __attribute__((vector_size(8))) unsigned int gv8;
   gv8 = gccv;     // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int'}}
   av = gv8;       // expected-error {{assigning to '__vector unsigned int' from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}}
+  vf__a(gccv2);
 
   v = gccv;
   __vector unsigned int tv = gccv;
Index: test/Parser/cxx-altivec.cpp
===================================================================
--- test/Parser/cxx-altivec.cpp	(revision 107555)
+++ test/Parser/cxx-altivec.cpp	(working copy)
@@ -19,7 +19,7 @@
 __vector __pixel vv_p;
 __vector pixel vv__p;
 __vector int vf__r();
-void vf__a(__vector int a);
+void vf__a(__vector int a) {};
 void vf__a2(int b, __vector int a);
 
 vector char v_c;
@@ -72,7 +72,7 @@
 vector bool double v_bd;             // expected-error {{cannot use 'double' with '__vector bool'}}
 vector bool pixel v_bp;              // expected-error {{cannot use '__pixel' with '__vector bool'}}
 vector bool signed char v_bsc;       // expected-error {{cannot use 'signed' with '__vector bool'}}
-vector bool unsigned int v_bsc2;      // expected-error {{cannot use 'unsigned' with '__vector bool'}}
+vector bool unsigned int v_bsc2;     // expected-error {{cannot use 'unsigned' with '__vector bool'}}
 vector bool long v_bl;               // expected-error {{cannot use 'long' with '__vector bool'}}
 vector bool long long v_bll;         // expected-error {{cannot use 'long long' with '__vector bool'}}
 
@@ -95,6 +95,7 @@
   __attribute__((vector_size(8))) unsigned int gv8;
   gv8 = gccv;     // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int'}}
   av = gv8;       // expected-error {{assigning to '__vector unsigned int' from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}}
+  vf__a(gccv2);
 
   v = gccv;
   __vector unsigned int tv = gccv;
