diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index de566b6cdfc..925af4e17e1 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -5460,11 +5460,12 @@ int LLParser::ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) { return true; Type *PtrTy = Ptr->getType(); - if (!isa<SequentialType>(PtrTy)) - return Error(Loc, "pointer type is not valid"); if (VectorType *VT = dyn_cast<VectorType>(PtrTy)) PtrTy = VT->getElementType(); - if (Ty != cast<SequentialType>(PtrTy)->getElementType()) + SequentialType *SeqPtrTy = dyn_cast<SequentialType>(PtrTy); + if (!SeqPtrTy) + return Error(Loc, "pointer type is not valid"); + if (Ty != SeqPtrTy->getElementType()) return Error(ExplicitTypeLoc, "explicit pointee type doesn't match operand's pointee type"); |

