diff options
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 4095545..3797a44 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1356,13 +1356,7 @@ Type *BitcodeReader::getPtrElementTypeByID(unsigned ID) { if (!Ty->isPointerTy()) return nullptr; - Type *ElemTy = getTypeByID(getContainedTypeID(ID, 0)); - if (!ElemTy) - return nullptr; - - assert(cast<PointerType>(Ty)->isOpaqueOrPointeeTypeMatches(ElemTy) && - "Incorrect element type"); - return ElemTy; + return getTypeByID(getContainedTypeID(ID, 0)); } unsigned BitcodeReader::getVirtualTypeID(Type *Ty, @@ -3273,9 +3267,7 @@ Error BitcodeReader::parseConstants() { PointeeType = getPtrElementTypeByID(BaseTypeID); if (!PointeeType) return error("Missing element type for old-style constant GEP"); - } else if (!OrigPtrTy->isOpaqueOrPointeeTypeMatches(PointeeType)) - return error("Explicit gep operator type does not match pointee type " - "of pointer operand"); + } V = BitcodeConstant::create(Alloc, CurTy, {Instruction::GetElementPtr, InBounds, @@ -4515,10 +4507,6 @@ Error BitcodeReader::parseBitcodeInto(Module *M, bool ShouldLazyLoadMetadata, Error BitcodeReader::typeCheckLoadStoreInst(Type *ValType, Type *PtrType) { if (!isa<PointerType>(PtrType)) return error("Load/Store operand is not a pointer type"); - - if (!cast<PointerType>(PtrType)->isOpaqueOrPointeeTypeMatches(ValType)) - return error("Explicit load/store type does not match pointee " - "type of pointer operand"); if (!PointerType::isLoadableOrStorableType(ValType)) return error("Cannot load/store from pointer"); return Error::success(); @@ -4945,10 +4933,6 @@ Error BitcodeReader::parseFunctionBody(Function *F) { if (BasePtr->getType()->isVectorTy()) TyID = getContainedTypeID(TyID); Ty = getTypeByID(TyID); - } else if (!cast<PointerType>(BasePtr->getType()->getScalarType()) - ->isOpaqueOrPointeeTypeMatches(Ty)) { - return error( - "Explicit gep type does not match pointee type of pointer operand"); } SmallVector<Value*, 16> GEPIdx; @@ -5539,9 +5523,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) { FTy = dyn_cast_or_null<FunctionType>(getTypeByID(FTyID)); if (!FTy) return error("Callee is not of pointer to function type"); - } else if (!CalleeTy->isOpaqueOrPointeeTypeMatches(FTy)) - return error("Explicit invoke type does not match pointee type of " - "callee operand"); + } if (Record.size() < FTy->getNumParams() + OpNum) return error("Insufficient operands to call"); @@ -5635,9 +5617,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) { FTy = dyn_cast_or_null<FunctionType>(getTypeByID(FTyID)); if (!FTy) return error("Callee is not of pointer to function type"); - } else if (!OpTy->isOpaqueOrPointeeTypeMatches(FTy)) - return error("Explicit call type does not match pointee type of " - "callee operand"); + } if (Record.size() < FTy->getNumParams() + OpNum) return error("Insufficient operands to call"); @@ -6345,9 +6325,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) { FTy = dyn_cast_or_null<FunctionType>(getTypeByID(FTyID)); if (!FTy) return error("Callee is not of pointer to function type"); - } else if (!OpTy->isOpaqueOrPointeeTypeMatches(FTy)) - return error("Explicit call type does not match pointee type of " - "callee operand"); + } if (Record.size() < FTy->getNumParams() + OpNum) return error("Insufficient operands to call"); |