[llvm] r343284 - [ScalarizeMaskedMemIntrin] Fix the alignment calculation for the scalar stores of a masked store expansion.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 27 18:06:14 PDT 2018
Author: ctopper
Date: Thu Sep 27 18:06:13 2018
New Revision: 343284
URL: http://llvm.org/viewvc/llvm-project?rev=343284&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp
llvm/trunk/test/Transforms/ScalarizeMaskedMemIntrin/X86/expand-masked-store.ll
Modified: llvm/trunk/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp?rev=343284&r1=343283&r2=343284&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp (original)
+++ llvm/trunk/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp Thu Sep 27 18:06:13 2018
@@ -276,7 +276,7 @@ static void scalarizeMaskedStore(CallIns
}
// 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());
Modified: llvm/trunk/test/Transforms/ScalarizeMaskedMemIntrin/X86/expand-masked-store.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ScalarizeMaskedMemIntrin/X86/expand-masked-store.ll?rev=343284&r1=343283&r2=343284&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/ScalarizeMaskedMemIntrin/X86/expand-masked-store.ll (original)
+++ llvm/trunk/test/Transforms/ScalarizeMaskedMemIntrin/X86/expand-masked-store.ll Thu Sep 27 18:06:13 2018
@@ -9,7 +9,7 @@ define void @scalarize_v2i64(<2 x i64>*
; CHECK: cond.store:
; CHECK-NEXT: [[TMP3:%.*]] = extractelement <2 x i64> [[DATA:%.*]], i32 0
; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i64, i64* [[TMP1]], i32 0
-; CHECK-NEXT: store i64 [[TMP3]], i64* [[TMP4]], align 128
+; CHECK-NEXT: store i64 [[TMP3]], i64* [[TMP4]], align 8
; CHECK-NEXT: br label [[ELSE]]
; CHECK: else:
; CHECK-NEXT: [[TMP5:%.*]] = extractelement <2 x i1> [[MASK]], i32 1
@@ -17,7 +17,7 @@ define void @scalarize_v2i64(<2 x i64>*
; CHECK: cond.store1:
; CHECK-NEXT: [[TMP6:%.*]] = extractelement <2 x i64> [[DATA]], i32 1
; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i64, i64* [[TMP1]], i32 1
-; CHECK-NEXT: store i64 [[TMP6]], i64* [[TMP7]], align 128
+; CHECK-NEXT: store i64 [[TMP6]], i64* [[TMP7]], align 8
; CHECK-NEXT: br label [[ELSE2]]
; CHECK: else2:
; CHECK-NEXT: ret void
More information about the llvm-commits
mailing list