diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp index a5faff679bad8..ce7141582911f 100644 --- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp @@ -2599,7 +2599,7 @@ InstructionCost AArch64TTIImpl::getShuffleCost(TTI::ShuffleKind Kind, std::pair LT = TLI->getTypeLegalizationCost(DL, Tp); // If we have a Mask, and the LT is being legalized somehow, split the Mask // into smaller vectors and sum the cost of each shuffle. - if (!Mask.empty() && isa(Tp) && + if (!Mask.empty() && isa(Tp) && LT.second.isVector() && Tp->getScalarSizeInBits() == LT.second.getScalarSizeInBits() && cast(Tp)->getNumElements() > LT.second.getVectorNumElements() &&