[opaque pointer type] Use the parsed explicit pointee type when error-checking geps during LL parsing

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235233 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2015-04-17 22:32:13 +00:00
parent 7349765ddb
commit 72981cdce3

View File

@ -5542,13 +5542,10 @@ int LLParser::ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) {
}
SmallPtrSet<const Type*, 4> Visited;
if (!Indices.empty() &&
!BasePointerType->getElementType()->isSized(&Visited))
if (!Indices.empty() && !Ty->isSized(&Visited))
return Error(Loc, "base element of getelementptr must be sized");
if (!GetElementPtrInst::getIndexedType(
cast<PointerType>(BaseType->getScalarType())->getElementType(),
Indices))
if (!GetElementPtrInst::getIndexedType(Ty, Indices))
return Error(Loc, "invalid getelementptr indices");
Inst = GetElementPtrInst::Create(Ty, Ptr, Indices);
if (InBounds)