summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-03-09 23:08:44 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-03-09 23:08:44 +0000
commit8d75794bfb9259d94f989513795b24b238593391 (patch)
tree2e2d26cd77ab92ed10b0e8e864fa0d5782239efb /llvm/lib/AsmParser/LLParser.cpp
parentc809761dc0695d2b9640378e01c994d4948b64f6 (diff)
downloadbcm5719-llvm-8d75794bfb9259d94f989513795b24b238593391.tar.gz
bcm5719-llvm-8d75794bfb9259d94f989513795b24b238593391.zip
LLParser: gep: Simplify parsing error handling
llvm-svn: 231722
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 67d74c0c121..65e622af66c 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -5465,21 +5465,15 @@ int LLParser::ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) {
ParseTypeAndValue(Ptr, Loc, PFS))
return true;
- Type *PtrTy = Ptr->getType();
- if (VectorType *VT = dyn_cast<VectorType>(PtrTy))
- PtrTy = VT->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");
-
Type *BaseType = Ptr->getType();
PointerType *BasePointerType = dyn_cast<PointerType>(BaseType->getScalarType());
if (!BasePointerType)
return Error(Loc, "base of getelementptr must be a pointer");
+ if (Ty != BasePointerType->getElementType())
+ return Error(ExplicitTypeLoc,
+ "explicit pointee type doesn't match operand's pointee type");
+
SmallVector<Value*, 16> Indices;
bool AteExtraComma = false;
while (EatIfPresent(lltok::comma)) {
OpenPOWER on IntegriCloud