@@ -1356,13 +1356,7 @@ Type *BitcodeReader::getPtrElementTypeByID(unsigned ID) {
1356
1356
if (!Ty->isPointerTy ())
1357
1357
return nullptr ;
1358
1358
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 ));
1366
1360
}
1367
1361
1368
1362
unsigned BitcodeReader::getVirtualTypeID (Type *Ty,
@@ -3273,9 +3267,7 @@ Error BitcodeReader::parseConstants() {
3273
3267
PointeeType = getPtrElementTypeByID (BaseTypeID);
3274
3268
if (!PointeeType)
3275
3269
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
+ }
3279
3271
3280
3272
V = BitcodeConstant::create (Alloc, CurTy,
3281
3273
{Instruction::GetElementPtr, InBounds,
@@ -4515,10 +4507,6 @@ Error BitcodeReader::parseBitcodeInto(Module *M, bool ShouldLazyLoadMetadata,
4515
4507
Error BitcodeReader::typeCheckLoadStoreInst (Type *ValType, Type *PtrType) {
4516
4508
if (!isa<PointerType>(PtrType))
4517
4509
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" );
4522
4510
if (!PointerType::isLoadableOrStorableType (ValType))
4523
4511
return error (" Cannot load/store from pointer" );
4524
4512
return Error::success ();
@@ -4945,10 +4933,6 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
4945
4933
if (BasePtr->getType ()->isVectorTy ())
4946
4934
TyID = getContainedTypeID (TyID);
4947
4935
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" );
4952
4936
}
4953
4937
4954
4938
SmallVector<Value*, 16 > GEPIdx;
@@ -5539,9 +5523,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
5539
5523
FTy = dyn_cast_or_null<FunctionType>(getTypeByID (FTyID));
5540
5524
if (!FTy)
5541
5525
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
+ }
5545
5527
if (Record.size () < FTy->getNumParams () + OpNum)
5546
5528
return error (" Insufficient operands to call" );
5547
5529
@@ -5635,9 +5617,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
5635
5617
FTy = dyn_cast_or_null<FunctionType>(getTypeByID (FTyID));
5636
5618
if (!FTy)
5637
5619
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
+ }
5641
5621
if (Record.size () < FTy->getNumParams () + OpNum)
5642
5622
return error (" Insufficient operands to call" );
5643
5623
@@ -6345,9 +6325,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
6345
6325
FTy = dyn_cast_or_null<FunctionType>(getTypeByID (FTyID));
6346
6326
if (!FTy)
6347
6327
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
+ }
6351
6329
if (Record.size () < FTy->getNumParams () + OpNum)
6352
6330
return error (" Insufficient operands to call" );
6353
6331
0 commit comments