Fix MergeInVectorType to check for vector types with the same alloc
size but different element types, so that it filters out the cases
that CreateShuffleVectorCast doesn't handle. This fixes rdar://9786827.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135721 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index fbf3092..b3d7ef6 100644
--- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
@@ -425,6 +425,12 @@
   Type *ElementTy = VectorTy->getElementType();
   Type *InElementTy = VInTy->getElementType();
 
+  // If they're the same alloc size, we'll be attempting to convert between
+  // them with a vector shuffle, which requires the element types to match.
+  if (TD.getTypeAllocSize(VectorTy) == TD.getTypeAllocSize(VInTy) &&
+      ElementTy != InElementTy)
+    return false;
+
   // Do not allow mixed integer and floating-point accesses from vectors of
   // different sizes.
   if (ElementTy->isFloatingPointTy() != InElementTy->isFloatingPointTy())