[OpaquePtr] Make GEPs work with opaque pointers

No verifier changes needed, the verifier currently doesn't check that
the pointer operand's pointee type matches the GEP type. There is a
similar check in GetElementPtrInst::Create() though.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D102744
This commit is contained in:
Arthur Eubanks
2021-05-18 15:23:00 -07:00
parent 4b074b49be
commit 28b9771472
4 changed files with 21 additions and 12 deletions

View File

@@ -4168,7 +4168,8 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
if (!Ty) {
std::tie(FullTy, Ty) =
getPointerElementTypes(FullBaseTy->getScalarType());
} else if (Ty != getPointerElementFlatType(FullBaseTy->getScalarType()))
} else if (!cast<PointerType>(FullBaseTy->getScalarType())
->isOpaqueOrPointeeTypeMatches(Ty))
return error(
"Explicit gep type does not match pointee type of pointer operand");