From 505335a99d46643eae7729c1d3ea7bf719c79382 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 18 Jul 2023 11:23:41 +0200 Subject: [Bitcode] Remove uses of isOpaqueOrPointeeTypeEquals() (NFC) --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 32 +++++-------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') 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(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(PtrType)) return error("Load/Store operand is not a pointer type"); - - if (!cast(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(BasePtr->getType()->getScalarType()) - ->isOpaqueOrPointeeTypeMatches(Ty)) { - return error( - "Explicit gep type does not match pointee type of pointer operand"); } SmallVector GEPIdx; @@ -5539,9 +5523,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) { FTy = dyn_cast_or_null(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(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(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"); -- cgit v1.1