diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h --- a/llvm/include/llvm/IR/IRBuilder.h +++ b/llvm/include/llvm/IR/IRBuilder.h @@ -770,13 +770,30 @@ Value *Mask); /// Create a call to Masked Gather intrinsic - CallInst *CreateMaskedGather(Value *Ptrs, unsigned Align, - Value *Mask = nullptr, - Value *PassThru = nullptr, - const Twine& Name = ""); + LLVM_ATTRIBUTE_DEPRECATED( + CallInst *CreateMaskedGather(Value *Ptrs, unsigned Alignment, + Value *Mask = nullptr, + Value *PassThru = nullptr, + const Twine &Name = ""), + "Use the version that takes Align instead") { + return CreateMaskedGather(Ptrs, Align(Alignment), Mask, PassThru, Name); + } + + /// Create a call to Masked Gather intrinsic + CallInst *CreateMaskedGather(Value *Ptrs, Align Alignment, + Value *Mask = nullptr, Value *PassThru = nullptr, + const Twine &Name = ""); + + /// Create a call to Masked Scatter intrinsic + LLVM_ATTRIBUTE_DEPRECATED( + CallInst *CreateMaskedScatter(Value *Val, Value *Ptrs, unsigned Alignment, + Value *Mask = nullptr), + "Use the version that takes Align instead") { + return CreateMaskedScatter(Val, Ptrs, Align(Alignment), Mask); + } /// Create a call to Masked Scatter intrinsic - CallInst *CreateMaskedScatter(Value *Val, Value *Ptrs, unsigned Align, + CallInst *CreateMaskedScatter(Value *Val, Value *Ptrs, Align Alignment, Value *Mask = nullptr); /// Create an assume intrinsic call that allows the optimizer to diff --git a/llvm/lib/IR/IRBuilder.cpp b/llvm/lib/IR/IRBuilder.cpp --- a/llvm/lib/IR/IRBuilder.cpp +++ b/llvm/lib/IR/IRBuilder.cpp @@ -523,9 +523,9 @@ /// \p PassThru - pass-through value that is used to fill the masked-off lanes /// of the result /// \p Name - name of the result variable -CallInst *IRBuilderBase::CreateMaskedGather(Value *Ptrs, unsigned Align, - Value *Mask, Value *PassThru, - const Twine& Name) { +CallInst *IRBuilderBase::CreateMaskedGather(Value *Ptrs, Align Alignment, + Value *Mask, Value *PassThru, + const Twine &Name) { auto PtrsTy = cast(Ptrs->getType()); auto PtrTy = cast(PtrsTy->getElementType()); unsigned NumElts = PtrsTy->getVectorNumElements(); @@ -539,7 +539,7 @@ PassThru = UndefValue::get(DataTy); Type *OverloadedTypes[] = {DataTy, PtrsTy}; - Value * Ops[] = {Ptrs, getInt32(Align), Mask, PassThru}; + Value *Ops[] = {Ptrs, getInt32(Alignment.value()), Mask, PassThru}; // We specify only one type when we create this intrinsic. Types of other // arguments are derived from this type. @@ -555,7 +555,7 @@ /// \p Mask - vector of booleans which indicates what vector lanes should /// be accessed in memory CallInst *IRBuilderBase::CreateMaskedScatter(Value *Data, Value *Ptrs, - unsigned Align, Value *Mask) { + Align Alignment, Value *Mask) { auto PtrsTy = cast(Ptrs->getType()); auto DataTy = cast(Data->getType()); unsigned NumElts = PtrsTy->getVectorNumElements(); @@ -572,7 +572,7 @@ NumElts)); Type *OverloadedTypes[] = {DataTy, PtrsTy}; - Value * Ops[] = {Data, Ptrs, getInt32(Align), Mask}; + Value *Ops[] = {Data, Ptrs, getInt32(Alignment.value()), Mask}; // We specify only one type when we create this intrinsic. Types of other // arguments are derived from this type. diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -2437,8 +2437,8 @@ if (CreateGatherScatter) { Value *MaskPart = isMaskRequired ? BlockInMaskParts[Part] : nullptr; Value *VectorGep = State.get(Addr, Part); - NewSI = Builder.CreateMaskedScatter(StoredVal, VectorGep, - Alignment.value(), MaskPart); + NewSI = Builder.CreateMaskedScatter(StoredVal, VectorGep, Alignment, + MaskPart); } else { if (Reverse) { // If we store to reverse consecutive memory locations, then we need @@ -2467,7 +2467,7 @@ if (CreateGatherScatter) { Value *MaskPart = isMaskRequired ? BlockInMaskParts[Part] : nullptr; Value *VectorGep = State.get(Addr, Part); - NewLI = Builder.CreateMaskedGather(VectorGep, Alignment.value(), MaskPart, + NewLI = Builder.CreateMaskedGather(VectorGep, Alignment, MaskPart, nullptr, "wide.masked.gather"); addMetadata(NewLI, LI); } else {