[ScalarizeMaskedMemIntrin] Fix the alignment calculation for the scalar stores of a masked store expansion.

It should be the minimum of the original alignment and the scalar size.

llvm-svn: 343284
diff --git a/llvm/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp b/llvm/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp
index 65787bf..33eeb1c 100644
--- a/llvm/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp
+++ b/llvm/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp
@@ -276,7 +276,7 @@
   }
 
   // Adjust alignment for the scalar instruction.
-  AlignVal = std::max(AlignVal, EltTy->getPrimitiveSizeInBits() / 8);
+  AlignVal = std::min(AlignVal, EltTy->getPrimitiveSizeInBits() / 8);
   // Bitcast %addr fron i8* to EltTy*
   Type *NewPtrType =
       EltTy->getPointerTo(cast<PointerType>(Ptr->getType())->getAddressSpace());