From 274db1d21ae26f70393e25d0e6723c9ed6e7542b Mon Sep 17 00:00:00 2001 From: Frederik Gossen Date: Fri, 24 Jul 2020 10:46:40 +0000 Subject: [PATCH] [MLIR][Shape] Pass Ops instead of Operations in shape lowering Shorten builder invocations by using Ops directly instead of `op.getOperation`. Differential Revision: https://reviews.llvm.org/D84430 --- mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp b/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp index 5e3a60d..5a974bc 100644 --- a/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp +++ b/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp @@ -55,8 +55,7 @@ public: matchAndRewrite(SrcOpTy op, ArrayRef operands, ConversionPatternRewriter &rewriter) const override { typename SrcOpTy::Adaptor adaptor(operands); - rewriter.replaceOpWithNewOp(op.getOperation(), adaptor.lhs(), - adaptor.rhs()); + rewriter.replaceOpWithNewOp(op, adaptor.lhs(), adaptor.rhs()); return success(); } }; @@ -123,8 +122,7 @@ public: LogicalResult ConstSizeOpConverter::matchAndRewrite( ConstSizeOp op, ArrayRef operands, ConversionPatternRewriter &rewriter) const { - rewriter.replaceOpWithNewOp(op.getOperation(), - op.value().getSExtValue()); + rewriter.replaceOpWithNewOp(op, op.value().getSExtValue()); return success(); } @@ -171,7 +169,7 @@ LogicalResult RankOpConverter::matchAndRewrite(shape::RankOp op, ArrayRef operands, ConversionPatternRewriter &rewriter) const { shape::RankOp::Adaptor transformed(operands); - rewriter.replaceOpWithNewOp(op.getOperation(), transformed.shape(), 0); + rewriter.replaceOpWithNewOp(op, transformed.shape(), 0); return success(); } -- 2.7.4