1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[IR] Don't accept null type in ConstantExpr::getGetElementPtr()

This is the same change as D105653, but for the constant expression
version of the API.
This commit is contained in:
Nikita Popov 2021-07-17 15:30:55 +02:00
parent dd3e030cca
commit afb69b12ce

View File

@ -2427,10 +2427,8 @@ Constant *ConstantExpr::getGetElementPtr(Type *Ty, Constant *C,
Optional<unsigned> InRangeIndex,
Type *OnlyIfReducedTy) {
PointerType *OrigPtrTy = cast<PointerType>(C->getType()->getScalarType());
if (!Ty)
Ty = OrigPtrTy->getElementType();
else
assert(OrigPtrTy->isOpaqueOrPointeeTypeMatches(Ty));
assert(Ty && "Must specify element type");
assert(OrigPtrTy->isOpaqueOrPointeeTypeMatches(Ty));
if (Constant *FC =
ConstantFoldGetElementPtr(Ty, C, InBounds, InRangeIndex, Idxs))