mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-12 18:02:43 +00:00
[IRBUilder] Introduce getAllOnesMask [nfc]
Simplify D99750 by factoring out a utility which we already have multiple instances of in tree.
This commit is contained in:
parent
ced7e4f53b
commit
9959cdb66a
@ -800,6 +800,12 @@ public:
|
||||
CallInst *CreateMaskedCompressStore(Value *Val, Value *Ptr,
|
||||
Value *Mask = nullptr);
|
||||
|
||||
/// Return an all true boolean vector (mask) with \p NumElts lanes.
|
||||
Value *getAllOnesMask(ElementCount NumElts) {
|
||||
VectorType *VTy = VectorType::get(Type::getInt1Ty(Context), NumElts);
|
||||
return Constant::getAllOnesValue(VTy);
|
||||
}
|
||||
|
||||
/// Create an assume intrinsic call that allows the optimizer to
|
||||
/// assume that the provided condition will be true.
|
||||
///
|
||||
|
@ -661,8 +661,7 @@ CallInst *IRBuilderBase::CreateMaskedGather(Type *Ty, Value *Ptrs,
|
||||
assert(NumElts == PtrsTy->getElementCount() && "Element count mismatch");
|
||||
|
||||
if (!Mask)
|
||||
Mask = Constant::getAllOnesValue(
|
||||
VectorType::get(Type::getInt1Ty(Context), NumElts));
|
||||
Mask = getAllOnesMask(NumElts);
|
||||
|
||||
if (!PassThru)
|
||||
PassThru = PoisonValue::get(Ty);
|
||||
@ -697,8 +696,7 @@ CallInst *IRBuilderBase::CreateMaskedScatter(Value *Data, Value *Ptrs,
|
||||
#endif
|
||||
|
||||
if (!Mask)
|
||||
Mask = Constant::getAllOnesValue(
|
||||
VectorType::get(Type::getInt1Ty(Context), NumElts));
|
||||
Mask = getAllOnesMask(NumElts);
|
||||
|
||||
Type *OverloadedTypes[] = {DataTy, PtrsTy};
|
||||
Value *Ops[] = {Data, Ptrs, getInt32(Alignment.value()), Mask};
|
||||
|
@ -32,9 +32,7 @@ Module &VectorBuilder::getModule() const {
|
||||
}
|
||||
|
||||
Value *VectorBuilder::getAllTrueMask() {
|
||||
auto *BoolTy = Builder.getInt1Ty();
|
||||
auto *MaskTy = VectorType::get(BoolTy, StaticVectorLength);
|
||||
return ConstantInt::getAllOnesValue(MaskTy);
|
||||
return Builder.getAllOnesMask(StaticVectorLength);
|
||||
}
|
||||
|
||||
Value &VectorBuilder::requestMask() {
|
||||
|
Loading…
Reference in New Issue
Block a user