From e106aee6f5737cd478c98f70bac73f1eb089c46f Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 21 Jul 2011 23:30:09 +0000 Subject: 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. llvm-svn: 135721 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/lib/Transforms') diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index fbf309292d8..b3d7ef6ec10 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -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()) -- cgit v1.2.3