-/// Ops - an array of operands.
-CallInst *IRBuilderBase::CreateMaskedLoad(ArrayRef<Value *> Ops) {
- // The only one overloaded type - the type of passthru value in this case
- Type *DataTy = Ops[3]->getType();
- return CreateMaskedIntrinsic(Intrinsic::masked_load, Ops, DataTy);
+/// Ptr - the base pointer for the load
+/// Align - alignment of the source location
+/// Mask - an vector of booleans which indicates what vector lanes should
+/// be accessed in memory
+/// PassThru - a pass-through value that is used to fill the masked-off lanes
+/// of the result
+/// Name - name of the result variable
+CallInst *IRBuilderBase::CreateMaskedLoad(Value *Ptr, unsigned Align,
+ Value *Mask, Value *PassThru,
+ const Twine &Name) {
+ assert(Ptr->getType()->isPointerTy() && "Ptr must be of pointer type");
+ // DataTy is the overloaded type
+ Type *DataTy = cast<PointerType>(Ptr->getType())->getElementType();
+ assert(DataTy->isVectorTy() && "Ptr should point to a vector");
+ if (!PassThru)
+ PassThru = UndefValue::get(DataTy);
+ Value *Ops[] = { Ptr, getInt32(Align), Mask, PassThru};
+ return CreateMaskedIntrinsic(Intrinsic::masked_load, Ops, DataTy, Name);