ArrayRef<const Value *> Operands, Type *AccessType,
TTI::TargetCostKind CostKind) {
assert(PointeeType && Ptr && "can't get GEPCost of nullptr");
- assert(cast<PointerType>(Ptr->getType()->getScalarType())
- ->isOpaqueOrPointeeTypeMatches(PointeeType) &&
- "explicit pointee type doesn't match operand's pointee type");
auto *BaseGV = dyn_cast<GlobalValue>(Ptr->stripPointerCasts());
bool HasBaseReg = (BaseGV == nullptr);
AtomicReductionGenTy AtomicReductionGen)
: ElementType(ElementType), Variable(Variable),
PrivateVariable(PrivateVariable), ReductionGen(ReductionGen),
- AtomicReductionGen(AtomicReductionGen) {
- assert(cast<PointerType>(Variable->getType())
- ->isOpaqueOrPointeeTypeMatches(ElementType) && "Invalid elem type");
- }
+ AtomicReductionGen(AtomicReductionGen) {}
/// Reduction element type, must match pointee type of variable.
Type *ElementType;
/// type.
void setCalledFunction(FunctionType *FTy, Value *Fn) {
this->FTy = FTy;
- assert(cast<PointerType>(Fn->getType())->isOpaqueOrPointeeTypeMatches(FTy));
// This function doesn't mutate the return type, only the function
// type. Seems broken, but I'm just gonna stick an assert in for now.
assert(getType() == FTy->getReturnType());
Instruction *InsertBefore = nullptr) {
unsigned Values = 1 + unsigned(IdxList.size());
assert(PointeeType && "Must specify element type");
- assert(cast<PointerType>(Ptr->getType()->getScalarType())
- ->isOpaqueOrPointeeTypeMatches(PointeeType));
return new (Values) GetElementPtrInst(PointeeType, Ptr, IdxList, Values,
NameStr, InsertBefore);
}
BasicBlock *InsertAtEnd) {
unsigned Values = 1 + unsigned(IdxList.size());
assert(PointeeType && "Must specify element type");
- assert(cast<PointerType>(Ptr->getType()->getScalarType())
- ->isOpaqueOrPointeeTypeMatches(PointeeType));
return new (Values) GetElementPtrInst(PointeeType, Ptr, IdxList, Values,
NameStr, InsertAtEnd);
}
void setResultElementType(Type *Ty) { ResultElementType = Ty; }
Type *getResultElementType() const {
- assert(cast<PointerType>(getType()->getScalarType())
- ->isOpaqueOrPointeeTypeMatches(ResultElementType));
return ResultElementType;
}
Values, InsertBefore),
SourceElementType(PointeeType),
ResultElementType(getIndexedType(PointeeType, IdxList)) {
- assert(cast<PointerType>(getType()->getScalarType())
- ->isOpaqueOrPointeeTypeMatches(ResultElementType));
init(Ptr, IdxList, NameStr);
}
Values, InsertAtEnd),
SourceElementType(PointeeType),
ResultElementType(getIndexedType(PointeeType, IdxList)) {
- assert(cast<PointerType>(getType()->getScalarType())
- ->isOpaqueOrPointeeTypeMatches(ResultElementType));
init(Ptr, IdxList, NameStr);
}
ScalarEvolution &SE, bool StrictCheck,
bool CheckType) {
assert(PtrA && PtrB && "Expected non-nullptr pointers.");
- assert(cast<PointerType>(PtrA->getType())
- ->isOpaqueOrPointeeTypeMatches(ElemTyA) && "Wrong PtrA type");
- assert(cast<PointerType>(PtrB->getType())
- ->isOpaqueOrPointeeTypeMatches(ElemTyB) && "Wrong PtrB type");
// Make sure that A and B are different pointers.
if (PtrA == PtrB)
PointerType *OrigPtrTy = cast<PointerType>(C->getType()->getScalarType());
assert(Ty && "Must specify element type");
assert(isSupportedGetElementPtr(Ty) && "Element type is unsupported!");
- assert(OrigPtrTy->isOpaqueOrPointeeTypeMatches(Ty));
if (Constant *FC =
ConstantFoldGetElementPtr(Ty, C, InBounds, InRangeIndex, Idxs))
Align Align, AtomicOrdering Order, SyncScope::ID SSID,
Instruction *InsertBef)
: UnaryInstruction(Ty, Load, Ptr, InsertBef) {
- assert(cast<PointerType>(Ptr->getType())->isOpaqueOrPointeeTypeMatches(Ty));
setVolatile(isVolatile);
setAlignment(Align);
setAtomic(Order, SSID);
Align Align, AtomicOrdering Order, SyncScope::ID SSID,
BasicBlock *InsertAE)
: UnaryInstruction(Ty, Load, Ptr, InsertAE) {
- assert(cast<PointerType>(Ptr->getType())->isOpaqueOrPointeeTypeMatches(Ty));
setVolatile(isVolatile);
setAlignment(Align);
setAtomic(Order, SSID);
assert(getOperand(0) && getOperand(1) && "Both operands must be non-null!");
assert(getOperand(1)->getType()->isPointerTy() &&
"Ptr must have pointer type!");
- assert(cast<PointerType>(getOperand(1)->getType())
- ->isOpaqueOrPointeeTypeMatches(getOperand(0)->getType()) &&
- "Ptr must be a pointer to Val type!");
}
StoreInst::StoreInst(Value *val, Value *addr, Instruction *InsertBefore)
"All operands must be non-null!");
assert(getOperand(0)->getType()->isPointerTy() &&
"Ptr must have pointer type!");
- assert(cast<PointerType>(getOperand(0)->getType())
- ->isOpaqueOrPointeeTypeMatches(getOperand(1)->getType()) &&
- "Ptr must be a pointer to Cmp type!");
- assert(cast<PointerType>(getOperand(0)->getType())
- ->isOpaqueOrPointeeTypeMatches(getOperand(2)->getType()) &&
- "Ptr must be a pointer to NewVal type!");
assert(getOperand(1)->getType() == getOperand(2)->getType() &&
"Cmp type and NewVal type must be same!");
}
"All operands must be non-null!");
assert(getOperand(0)->getType()->isPointerTy() &&
"Ptr must have pointer type!");
- assert(cast<PointerType>(getOperand(0)->getType())
- ->isOpaqueOrPointeeTypeMatches(getOperand(1)->getType()) &&
- "Ptr must be a pointer to Val type!");
assert(Ordering != AtomicOrdering::NotAtomic &&
"AtomicRMW instructions must be atomic!");
}
return;
Value *CachedSlot = nullptr;
auto getSwiftErrorSlot = [&](Type *ValueTy) -> Value * {
- if (CachedSlot) {
- assert(cast<PointerType>(CachedSlot->getType())
- ->isOpaqueOrPointeeTypeMatches(ValueTy) &&
- "multiple swifterror slots in function with different types");
+ if (CachedSlot)
return CachedSlot;
- }
// Check if the function has a swifterror argument.
for (auto &Arg : F.args()) {
if (Arg.isSwiftError()) {
CachedSlot = &Arg;
- assert(cast<PointerType>(Arg.getType())
- ->isOpaqueOrPointeeTypeMatches(ValueTy) &&
- "swifterror argument does not have expected type");
return &Arg;
}
}
int ThreadSanitizer::getMemoryAccessFuncIndex(Type *OrigTy, Value *Addr,
const DataLayout &DL) {
assert(OrigTy->isSized());
- assert(
- cast<PointerType>(Addr->getType())->isOpaqueOrPointeeTypeMatches(OrigTy));
uint32_t TypeSize = DL.getTypeStoreSizeInBits(OrigTy);
if (TypeSize != 8 && TypeSize != 16 &&
TypeSize != 32 && TypeSize != 64 && TypeSize != 128) {
Scatterer::Scatterer(BasicBlock *bb, BasicBlock::iterator bbi, Value *v,
const VectorSplit &VS, ValueVector *cachePtr)
: BB(bb), BBI(bbi), V(v), VS(VS), CachePtr(cachePtr) {
- Type *Ty = V->getType();
- if (Ty->isPointerTy()) {
- assert(cast<PointerType>(Ty)->isOpaqueOrPointeeTypeMatches(VS.VecTy) &&
- "Pointer element type mismatch");
- IsPointer = true;
- } else {
- IsPointer = false;
- }
+ IsPointer = V->getType()->isPointerTy();
if (!CachePtr) {
Tmp.resize(VS.NumFragments, nullptr);
} else {
const Function *CalledFunc,
InlineFunctionInfo &IFI,
MaybeAlign ByValAlignment) {
- assert(cast<PointerType>(Arg->getType())
- ->isOpaqueOrPointeeTypeMatches(ByValType));
Function *Caller = TheCall->getFunction();
const DataLayout &DL = Caller->getParent()->getDataLayout();
Type *Arg2Type = OutlinedFn->getArg(2)->getType();
EXPECT_TRUE(Arg2Type->isPointerTy());
- EXPECT_TRUE(
- cast<PointerType>(Arg2Type)->isOpaqueOrPointeeTypeMatches(ArgStructTy));
}
TEST_F(OpenMPIRBuilderTest, CanonicalLoopSimple) {
EXPECT_TRUE(MapperAllocas.ArgsBase->getAllocatedType()
->getArrayElementType()
->isPointerTy());
- EXPECT_TRUE(
- cast<PointerType>(
- MapperAllocas.ArgsBase->getAllocatedType()->getArrayElementType())
- ->isOpaqueOrPointeeTypeMatches(Builder.getInt8Ty()));
EXPECT_TRUE(MapperAllocas.Args->getAllocatedType()->isArrayTy());
ArrType = dyn_cast<ArrayType>(MapperAllocas.Args->getAllocatedType());
EXPECT_TRUE(MapperAllocas.Args->getAllocatedType()
->getArrayElementType()
->isPointerTy());
- EXPECT_TRUE(cast<PointerType>(
- MapperAllocas.Args->getAllocatedType()->getArrayElementType())
- ->isOpaqueOrPointeeTypeMatches(Builder.getInt8Ty()));
EXPECT_TRUE(MapperAllocas.ArgSizes->getAllocatedType()->isArrayTy());
ArrType = dyn_cast<ArrayType>(MapperAllocas.ArgSizes->getAllocatedType());