[OpaquePtr] Support opaque constant expression GEP
Adjust assertions to use isOpaqueOrPointeeTypeMatches() and make it return an opaque pointer result for an opaque base pointer. We also need to enumerate the element type, as it is no longer implicitly enumerated through the pointer type. Differential Revision: https://reviews.llvm.org/D104655
This commit is contained in:
@@ -2663,11 +2663,10 @@ Error BitcodeReader::parseConstants() {
|
||||
if (Elts.size() < 1)
|
||||
return error("Invalid gep with no operands");
|
||||
|
||||
Type *ImplicitPointeeType =
|
||||
cast<PointerType>(Elt0FullTy->getScalarType())->getElementType();
|
||||
PointerType *OrigPtrTy = cast<PointerType>(Elt0FullTy->getScalarType());
|
||||
if (!PointeeType)
|
||||
PointeeType = ImplicitPointeeType;
|
||||
else if (PointeeType != ImplicitPointeeType)
|
||||
PointeeType = OrigPtrTy->getElementType();
|
||||
else if (!OrigPtrTy->isOpaqueOrPointeeTypeMatches(PointeeType))
|
||||
return error("Explicit gep operator type does not match pointee type "
|
||||
"of pointer operand");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user