diff --git a/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp b/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp --- a/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp +++ b/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp @@ -798,9 +798,8 @@ // Check that the provided indices list is not empty before parsing their // type list. if (indicesInfo.empty()) { - emitError(state.location, "'spv.AccessChain' op expected at least " - "one index "); - return failure(); + return emitError(state.location, "'spv.AccessChain' op expected at " + "least one index "); } if (parser.parseComma() || parser.parseTypeList(indicesTypes)) @@ -808,10 +807,10 @@ // Check that the indices types list is not empty and that it has a one-to-one // mapping to the provided indices. - if (indicesTypes.empty() || indicesTypes.size() != indicesInfo.size()) { - emitError(state.location, "'spv.AccessChain' op indices types' count" - " must be equal to indices info count"); - return failure(); + if (indicesTypes.size() != indicesInfo.size()) { + return emitError(state.location, "'spv.AccessChain' op indices " + "types' count must be equal to indices " + "info count"); } if (parser.resolveOperands(indicesInfo, indicesTypes, loc, state.operands)) @@ -829,11 +828,8 @@ static void print(spirv::AccessChainOp op, OpAsmPrinter &printer) { printer << spirv::AccessChainOp::getOperationName() << ' ' << op.base_ptr() - << '[' << op.indices() << "] : " << op.base_ptr().getType(); - - for (auto index : op.indices()) { - printer << ", " << index.getType(); - } + << '[' << op.indices() << "] : " << op.base_ptr().getType() << ", " + << op.indices().getTypes(); } static LogicalResult verify(spirv::AccessChainOp accessChainOp) {