[opaque pointer type] API migration for GEP constant factories
[oota-llvm.git] / lib / AsmParser / LLParser.cpp
index ed1d0ff9ee646bbe9874479e65b99846690d8828..d735063d5dc029ccbd53bc378334ab9017b0ffdd 100644 (file)
@@ -2831,13 +2831,10 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
           !BasePointerType->getElementType()->isSized(&Visited))
         return Error(ID.Loc, "base element of getelementptr must be sized");
 
-      if (!GetElementPtrInst::getIndexedType(
-              cast<PointerType>(Elts[0]->getType()->getScalarType())
-                  ->getElementType(),
-              Indices))
+      if (!GetElementPtrInst::getIndexedType(Ty, Indices))
         return Error(ID.Loc, "invalid getelementptr indices");
-      ID.ConstantVal = ConstantExpr::getGetElementPtr(Elts[0], Indices,
-                                                      InBounds);
+      ID.ConstantVal =
+          ConstantExpr::getGetElementPtr(Ty, Elts[0], Indices, InBounds);
     } else if (Opc == Instruction::Select) {
       if (Elts.size() != 3)
         return Error(ID.Loc, "expected three operands to select");