Skip to content

Commit 505335a

Browse files
committed
[Bitcode] Remove uses of isOpaqueOrPointeeTypeEquals() (NFC)
1 parent 29b5666 commit 505335a

File tree

1 file changed

+5
-27
lines changed

1 file changed

+5
-27
lines changed

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,13 +1356,7 @@ Type *BitcodeReader::getPtrElementTypeByID(unsigned ID) {
13561356
if (!Ty->isPointerTy())
13571357
return nullptr;
13581358

1359-
Type *ElemTy = getTypeByID(getContainedTypeID(ID, 0));
1360-
if (!ElemTy)
1361-
return nullptr;
1362-
1363-
assert(cast<PointerType>(Ty)->isOpaqueOrPointeeTypeMatches(ElemTy) &&
1364-
"Incorrect element type");
1365-
return ElemTy;
1359+
return getTypeByID(getContainedTypeID(ID, 0));
13661360
}
13671361

13681362
unsigned BitcodeReader::getVirtualTypeID(Type *Ty,
@@ -3273,9 +3267,7 @@ Error BitcodeReader::parseConstants() {
32733267
PointeeType = getPtrElementTypeByID(BaseTypeID);
32743268
if (!PointeeType)
32753269
return error("Missing element type for old-style constant GEP");
3276-
} else if (!OrigPtrTy->isOpaqueOrPointeeTypeMatches(PointeeType))
3277-
return error("Explicit gep operator type does not match pointee type "
3278-
"of pointer operand");
3270+
}
32793271

32803272
V = BitcodeConstant::create(Alloc, CurTy,
32813273
{Instruction::GetElementPtr, InBounds,
@@ -4515,10 +4507,6 @@ Error BitcodeReader::parseBitcodeInto(Module *M, bool ShouldLazyLoadMetadata,
45154507
Error BitcodeReader::typeCheckLoadStoreInst(Type *ValType, Type *PtrType) {
45164508
if (!isa<PointerType>(PtrType))
45174509
return error("Load/Store operand is not a pointer type");
4518-
4519-
if (!cast<PointerType>(PtrType)->isOpaqueOrPointeeTypeMatches(ValType))
4520-
return error("Explicit load/store type does not match pointee "
4521-
"type of pointer operand");
45224510
if (!PointerType::isLoadableOrStorableType(ValType))
45234511
return error("Cannot load/store from pointer");
45244512
return Error::success();
@@ -4945,10 +4933,6 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
49454933
if (BasePtr->getType()->isVectorTy())
49464934
TyID = getContainedTypeID(TyID);
49474935
Ty = getTypeByID(TyID);
4948-
} else if (!cast<PointerType>(BasePtr->getType()->getScalarType())
4949-
->isOpaqueOrPointeeTypeMatches(Ty)) {
4950-
return error(
4951-
"Explicit gep type does not match pointee type of pointer operand");
49524936
}
49534937

49544938
SmallVector<Value*, 16> GEPIdx;
@@ -5539,9 +5523,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
55395523
FTy = dyn_cast_or_null<FunctionType>(getTypeByID(FTyID));
55405524
if (!FTy)
55415525
return error("Callee is not of pointer to function type");
5542-
} else if (!CalleeTy->isOpaqueOrPointeeTypeMatches(FTy))
5543-
return error("Explicit invoke type does not match pointee type of "
5544-
"callee operand");
5526+
}
55455527
if (Record.size() < FTy->getNumParams() + OpNum)
55465528
return error("Insufficient operands to call");
55475529

@@ -5635,9 +5617,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
56355617
FTy = dyn_cast_or_null<FunctionType>(getTypeByID(FTyID));
56365618
if (!FTy)
56375619
return error("Callee is not of pointer to function type");
5638-
} else if (!OpTy->isOpaqueOrPointeeTypeMatches(FTy))
5639-
return error("Explicit call type does not match pointee type of "
5640-
"callee operand");
5620+
}
56415621
if (Record.size() < FTy->getNumParams() + OpNum)
56425622
return error("Insufficient operands to call");
56435623

@@ -6345,9 +6325,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
63456325
FTy = dyn_cast_or_null<FunctionType>(getTypeByID(FTyID));
63466326
if (!FTy)
63476327
return error("Callee is not of pointer to function type");
6348-
} else if (!OpTy->isOpaqueOrPointeeTypeMatches(FTy))
6349-
return error("Explicit call type does not match pointee type of "
6350-
"callee operand");
6328+
}
63516329
if (Record.size() < FTy->getNumParams() + OpNum)
63526330
return error("Insufficient operands to call");
63536331

0 commit comments

Comments
 (0)