forked from OSchip/llvm-project
Revert "[IR] Don't accept nullptr as GEP element type"
This reverts commit 5035e7be1a
.
This change broke several lldb bots.
This commit is contained in:
parent
739f49ed12
commit
a821df993d
|
@ -956,9 +956,13 @@ public:
|
||||||
const Twine &NameStr = "",
|
const Twine &NameStr = "",
|
||||||
Instruction *InsertBefore = nullptr) {
|
Instruction *InsertBefore = nullptr) {
|
||||||
unsigned Values = 1 + unsigned(IdxList.size());
|
unsigned Values = 1 + unsigned(IdxList.size());
|
||||||
assert(PointeeType && "Must specify element type");
|
if (!PointeeType) {
|
||||||
assert(cast<PointerType>(Ptr->getType()->getScalarType())
|
PointeeType =
|
||||||
->isOpaqueOrPointeeTypeMatches(PointeeType));
|
cast<PointerType>(Ptr->getType()->getScalarType())->getElementType();
|
||||||
|
} else {
|
||||||
|
assert(cast<PointerType>(Ptr->getType()->getScalarType())
|
||||||
|
->isOpaqueOrPointeeTypeMatches(PointeeType));
|
||||||
|
}
|
||||||
return new (Values) GetElementPtrInst(PointeeType, Ptr, IdxList, Values,
|
return new (Values) GetElementPtrInst(PointeeType, Ptr, IdxList, Values,
|
||||||
NameStr, InsertBefore);
|
NameStr, InsertBefore);
|
||||||
}
|
}
|
||||||
|
@ -968,9 +972,13 @@ public:
|
||||||
const Twine &NameStr,
|
const Twine &NameStr,
|
||||||
BasicBlock *InsertAtEnd) {
|
BasicBlock *InsertAtEnd) {
|
||||||
unsigned Values = 1 + unsigned(IdxList.size());
|
unsigned Values = 1 + unsigned(IdxList.size());
|
||||||
assert(PointeeType && "Must specify element type");
|
if (!PointeeType) {
|
||||||
assert(cast<PointerType>(Ptr->getType()->getScalarType())
|
PointeeType =
|
||||||
->isOpaqueOrPointeeTypeMatches(PointeeType));
|
cast<PointerType>(Ptr->getType()->getScalarType())->getElementType();
|
||||||
|
} else {
|
||||||
|
assert(cast<PointerType>(Ptr->getType()->getScalarType())
|
||||||
|
->isOpaqueOrPointeeTypeMatches(PointeeType));
|
||||||
|
}
|
||||||
return new (Values) GetElementPtrInst(PointeeType, Ptr, IdxList, Values,
|
return new (Values) GetElementPtrInst(PointeeType, Ptr, IdxList, Values,
|
||||||
NameStr, InsertAtEnd);
|
NameStr, InsertAtEnd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue