mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 01:16:05 +00:00
[IRBuilder] Avoid fetching pointer element type in some assertions
Specifically the CreateMaskedStore and CreateMaskedScatter APIs. The CreateMaskedLoad and CreateMaskedGather APIs will need an additional type argument.
This commit is contained in:
parent
45e5214b43
commit
e91440628e
@ -524,8 +524,9 @@ CallInst *IRBuilderBase::CreateMaskedLoad(Value *Ptr, Align Alignment,
|
||||
CallInst *IRBuilderBase::CreateMaskedStore(Value *Val, Value *Ptr,
|
||||
Align Alignment, Value *Mask) {
|
||||
auto *PtrTy = cast<PointerType>(Ptr->getType());
|
||||
Type *DataTy = PtrTy->getElementType();
|
||||
assert(DataTy->isVectorTy() && "Ptr should point to a vector");
|
||||
Type *DataTy = Val->getType();
|
||||
assert(DataTy->isVectorTy() && "Val should be a vector");
|
||||
assert(PtrTy->isOpaqueOrPointeeTypeMatches(DataTy) && "Wrong element type");
|
||||
assert(Mask && "Mask should not be all-ones (null)");
|
||||
Type *OverloadedTypes[] = { DataTy, PtrTy };
|
||||
Value *Ops[] = {Val, Ptr, getInt32(Alignment.value()), Mask};
|
||||
@ -590,9 +591,9 @@ CallInst *IRBuilderBase::CreateMaskedScatter(Value *Data, Value *Ptrs,
|
||||
ElementCount NumElts = PtrsTy->getElementCount();
|
||||
|
||||
#ifndef NDEBUG
|
||||
auto PtrTy = cast<PointerType>(PtrsTy->getElementType());
|
||||
auto *PtrTy = cast<PointerType>(PtrsTy->getElementType());
|
||||
assert(NumElts == DataTy->getElementCount() &&
|
||||
PtrTy->getElementType() == DataTy->getElementType() &&
|
||||
PtrTy->isOpaqueOrPointeeTypeMatches(DataTy->getElementType()) &&
|
||||
"Incompatible pointer and data types");
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user