forked from OSchip/llvm-project
[OpaquePtr] Remove some uses of PointerType::getElementType()
This commit is contained in:
parent
db26cd30b6
commit
372237487e
|
@ -1442,8 +1442,7 @@ public:
|
|||
/// 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());
|
||||
|
|
|
@ -1017,8 +1017,8 @@ public:
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -1160,8 +1160,8 @@ GetElementPtrInst::GetElementPtrInst(Type *PointeeType, Value *Ptr,
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -1174,8 +1174,8 @@ GetElementPtrInst::GetElementPtrInst(Type *PointeeType, Value *Ptr,
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -441,7 +441,7 @@ bool AtomicExpand::expandAtomicLoadToCmpXchg(LoadInst *LI) {
|
|||
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(
|
||||
|
|
|
@ -1017,7 +1017,7 @@ void Interpreter::SwitchToNewBasicBlock(BasicBlock *Dest, ExecutionContext &SF){
|
|||
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 =
|
||||
|
|
|
@ -369,7 +369,7 @@ static void createResumeEntryBlock(Function &F, coro::Shape &Shape) {
|
|||
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(
|
||||
|
|
Loading…
Reference in New Issue