From e2232fbcee8a4bf4e2a6ab181f8fabb57633dda6 Mon Sep 17 00:00:00 2001 From: Aart Bik Date: Tue, 26 Nov 2019 19:52:02 -0800 Subject: [VectorOps] Refine BroadcastOp in VectorOps dialect Since second argument is always fully overwritten and shape is define in "to" clause, it is not needed. Also renamed "into" to "to" now that arg is dropped. PiperOrigin-RevId: 282686475 --- mlir/lib/Dialect/VectorOps/VectorOps.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'mlir/lib/Dialect/VectorOps/VectorOps.cpp') diff --git a/mlir/lib/Dialect/VectorOps/VectorOps.cpp b/mlir/lib/Dialect/VectorOps/VectorOps.cpp index d09fd0fc2f2..fe320b91439 100644 --- a/mlir/lib/Dialect/VectorOps/VectorOps.cpp +++ b/mlir/lib/Dialect/VectorOps/VectorOps.cpp @@ -373,14 +373,14 @@ static LogicalResult verify(ExtractElementOp op) { //===----------------------------------------------------------------------===// static void print(OpAsmPrinter &p, BroadcastOp op) { - p << op.getOperationName() << " " << *op.source() << ", " << *op.dest(); + p << op.getOperationName() << " " << *op.source(); p << " : " << op.getSourceType(); - p << " into " << op.getDestVectorType(); + p << " to " << op.getVectorType(); } static LogicalResult verify(BroadcastOp op) { VectorType srcVectorType = op.getSourceType().dyn_cast(); - VectorType dstVectorType = op.getDestVectorType(); + VectorType dstVectorType = op.getVectorType(); // Scalar to vector broadcast is always valid. A vector // to vector broadcast needs some additional checking. if (srcVectorType) { @@ -397,16 +397,14 @@ static LogicalResult verify(BroadcastOp op) { static ParseResult parseBroadcastOp(OpAsmParser &parser, OperationState &result) { - OpAsmParser::OperandType source, dest; + OpAsmParser::OperandType source; Type sourceType; - VectorType destType; - return failure(parser.parseOperand(source) || parser.parseComma() || - parser.parseOperand(dest) || + VectorType vectorType; + return failure(parser.parseOperand(source) || parser.parseColonType(sourceType) || - parser.parseKeywordType("into", destType) || + parser.parseKeywordType("to", vectorType) || parser.resolveOperand(source, sourceType, result.operands) || - parser.resolveOperand(dest, destType, result.operands) || - parser.addTypeToList(destType, result.types)); + parser.addTypeToList(vectorType, result.types)); } //===----------------------------------------------------------------------===// -- cgit v1.2.3