/// type.
void setCalledFunction(FunctionType *FTy, Value *Fn) {
this->FTy = FTy;
- assert(FTy == cast<FunctionType>(
- cast<PointerType>(Fn->getType())->getElementType()));
+ 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());
void setResultElementType(Type *Ty) { ResultElementType = Ty; }
Type *getResultElementType() const {
- assert(ResultElementType ==
- cast<PointerType>(getType()->getScalarType())->getElementType());
+ assert(cast<PointerType>(getType()->getScalarType())
+ ->isOpaqueOrPointeeTypeMatches(ResultElementType));
return ResultElementType;
}
Values, InsertBefore),
SourceElementType(PointeeType),
ResultElementType(getIndexedType(PointeeType, IdxList)) {
- assert(ResultElementType ==
- cast<PointerType>(getType()->getScalarType())->getElementType());
+ assert(cast<PointerType>(getType()->getScalarType())
+ ->isOpaqueOrPointeeTypeMatches(ResultElementType));
init(Ptr, IdxList, NameStr);
}
Values, InsertAtEnd),
SourceElementType(PointeeType),
ResultElementType(getIndexedType(PointeeType, IdxList)) {
- assert(ResultElementType ==
- cast<PointerType>(getType()->getScalarType())->getElementType());
+ assert(cast<PointerType>(getType()->getScalarType())
+ ->isOpaqueOrPointeeTypeMatches(ResultElementType));
init(Ptr, IdxList, NameStr);
}
Order = AtomicOrdering::Monotonic;
Value *Addr = LI->getPointerOperand();
- Type *Ty = cast<PointerType>(Addr->getType())->getElementType();
+ Type *Ty = LI->getType();
Constant *DummyVal = Constant::getNullValue(Ty);
Value *Pair = Builder.CreateAtomicCmpXchg(
void Interpreter::visitAllocaInst(AllocaInst &I) {
ExecutionContext &SF = ECStack.back();
- Type *Ty = I.getType()->getElementType(); // Type to be allocated
+ Type *Ty = I.getAllocatedType(); // Type to be allocated
// Get the number of elements being allocated by the array...
unsigned NumElements =
coro::Shape::SwitchFieldIndex::Resume,
"ResumeFn.addr");
auto *NullPtr = ConstantPointerNull::get(cast<PointerType>(
- cast<PointerType>(GepIndex->getType())->getElementType()));
+ FrameTy->getTypeAtIndex(coro::Shape::SwitchFieldIndex::Resume)));
Builder.CreateStore(NullPtr, GepIndex);
} else {
auto *GepIndex = Builder.CreateStructGEP(