summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/AutoUpgrade.cpp34
-rw-r--r--llvm/lib/IR/IRBuilder.cpp25
2 files changed, 10 insertions, 49 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index ef80b63b0b8..8ba7ef4d26e 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -149,31 +149,6 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
break;
}
- case 'm': {
- if (Name.startswith("masked.load.")) {
- Type *Tys[] = { F->getReturnType(), F->arg_begin()->getType() };
- if (F->getName() != Intrinsic::getName(Intrinsic::masked_load, Tys)) {
- F->setName(Name + ".old");
- NewFn = Intrinsic::getDeclaration(F->getParent(),
- Intrinsic::masked_load,
- Tys);
- return true;
- }
- }
- if (Name.startswith("masked.store.")) {
- auto Args = F->getFunctionType()->params();
- Type *Tys[] = { Args[0], Args[1] };
- if (F->getName() != Intrinsic::getName(Intrinsic::masked_store, Tys)) {
- F->setName(Name + ".old");
- NewFn = Intrinsic::getDeclaration(F->getParent(),
- Intrinsic::masked_store,
- Tys);
- return true;
- }
- }
- break;
- }
-
case 'o':
// We only need to change the name to match the mangling including the
// address space.
@@ -1226,15 +1201,6 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
CI->eraseFromParent();
return;
}
-
- case Intrinsic::masked_load:
- case Intrinsic::masked_store: {
- SmallVector<Value *, 4> Args(CI->arg_operands().begin(),
- CI->arg_operands().end());
- CI->replaceAllUsesWith(Builder.CreateCall(NewFn, Args));
- CI->eraseFromParent();
- return;
- }
}
}
diff --git a/llvm/lib/IR/IRBuilder.cpp b/llvm/lib/IR/IRBuilder.cpp
index 298331d51c8..480e5e5d426 100644
--- a/llvm/lib/IR/IRBuilder.cpp
+++ b/llvm/lib/IR/IRBuilder.cpp
@@ -212,15 +212,13 @@ CallInst *IRBuilderBase::CreateAssumption(Value *Cond) {
CallInst *IRBuilderBase::CreateMaskedLoad(Value *Ptr, unsigned Align,
Value *Mask, Value *PassThru,
const Twine &Name) {
- PointerType *PtrTy = cast<PointerType>(Ptr->getType());
- Type *DataTy = PtrTy->getElementType();
+ // 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);
- Type *OverloadedTypes[] = { DataTy, PtrTy };
Value *Ops[] = { Ptr, getInt32(Align), Mask, PassThru};
- return CreateMaskedIntrinsic(Intrinsic::masked_load, Ops,
- OverloadedTypes, Name);
+ return CreateMaskedIntrinsic(Intrinsic::masked_load, Ops, DataTy, Name);
}
/// \brief Create a call to a Masked Store intrinsic.
@@ -231,22 +229,19 @@ CallInst *IRBuilderBase::CreateMaskedLoad(Value *Ptr, unsigned Align,
/// be accessed in memory
CallInst *IRBuilderBase::CreateMaskedStore(Value *Val, Value *Ptr,
unsigned Align, Value *Mask) {
- PointerType *PtrTy = cast<PointerType>(Ptr->getType());
- Type *DataTy = PtrTy->getElementType();
- assert(DataTy->isVectorTy() && "Ptr should point to a vector");
- Type *OverloadedTypes[] = { DataTy, PtrTy };
Value *Ops[] = { Val, Ptr, getInt32(Align), Mask };
- return CreateMaskedIntrinsic(Intrinsic::masked_store, Ops, OverloadedTypes);
+ // Type of the data to be stored - the only one overloaded type
+ return CreateMaskedIntrinsic(Intrinsic::masked_store, Ops, Val->getType());
}
/// Create a call to a Masked intrinsic, with given intrinsic Id,
-/// an array of operands - Ops, and an array of overloaded types -
-/// OverloadedTypes.
+/// an array of operands - Ops, and one overloaded type - DataTy
CallInst *IRBuilderBase::CreateMaskedIntrinsic(Intrinsic::ID Id,
ArrayRef<Value *> Ops,
- ArrayRef<Type *> OverloadedTypes,
+ Type *DataTy,
const Twine &Name) {
Module *M = BB->getParent()->getParent();
+ Type *OverloadedTypes[] = { DataTy };
Value *TheFn = Intrinsic::getDeclaration(M, Id, OverloadedTypes);
return createCallHelper(TheFn, Ops, this, Name);
}
@@ -275,7 +270,7 @@ CallInst *IRBuilderBase::CreateMaskedGather(Value *Ptrs, unsigned Align,
// We specify only one type when we create this intrinsic. Types of other
// arguments are derived from this type.
- return CreateMaskedIntrinsic(Intrinsic::masked_gather, Ops, { DataTy }, Name);
+ return CreateMaskedIntrinsic(Intrinsic::masked_gather, Ops, DataTy, Name);
}
/// \brief Create a call to a Masked Scatter intrinsic.
@@ -305,7 +300,7 @@ CallInst *IRBuilderBase::CreateMaskedScatter(Value *Data, Value *Ptrs,
// We specify only one type when we create this intrinsic. Types of other
// arguments are derived from this type.
- return CreateMaskedIntrinsic(Intrinsic::masked_scatter, Ops, { DataTy });
+ return CreateMaskedIntrinsic(Intrinsic::masked_scatter, Ops, DataTy);
}
template <typename T0, typename T1, typename T2, typename T3>
OpenPOWER on IntegriCloud