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
This commit is contained in:
Dan Gohman
2011-07-21 23:30:09 +00:00
parent 7c6e42e927
commit 856e13ddac
2 changed files with 33 additions and 0 deletions

View File

@@ -425,6 +425,12 @@ bool ConvertToScalarInfo::MergeInVectorType(VectorType *VInTy,
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())