diff --git a/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp b/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp --- a/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp @@ -959,8 +959,8 @@ unsigned AlignmentInt = cast(CI->getArgOperand(1))->getZExtValue(); Type *LoadTy = CI->getType(); - Align Alignment = - DL.getValueOrABITypeAlignment(MaybeAlign(AlignmentInt), LoadTy); + Align Alignment = DL.getValueOrABITypeAlignment(MaybeAlign(AlignmentInt), + LoadTy->getScalarType()); if (TTI.isLegalMaskedGather(LoadTy, Alignment)) return false; scalarizeMaskedGather(DL, CI, DTU, ModifiedDT); @@ -970,8 +970,8 @@ unsigned AlignmentInt = cast(CI->getArgOperand(2))->getZExtValue(); Type *StoreTy = CI->getArgOperand(0)->getType(); - Align Alignment = - DL.getValueOrABITypeAlignment(MaybeAlign(AlignmentInt), StoreTy); + Align Alignment = DL.getValueOrABITypeAlignment(MaybeAlign(AlignmentInt), + StoreTy->getScalarType()); if (TTI.isLegalMaskedScatter(StoreTy, Alignment)) return false; scalarizeMaskedScatter(DL, CI, DTU, ModifiedDT);