[Mlir-commits] [mlir] 274db1d - [MLIR][Shape] Pass Ops instead of Operations in shape lowering
Frederik Gossen
llvmlistbot at llvm.org
Fri Jul 24 03:47:46 PDT 2020
Author: Frederik Gossen
Date: 2020-07-24T10:47:23Z
New Revision: 274db1d21ae26f70393e25d0e6723c9ed6e7542b
URL: https://github.com/llvm/llvm-project/commit/274db1d21ae26f70393e25d0e6723c9ed6e7542b
DIFF: https://github.com/llvm/llvm-project/commit/274db1d21ae26f70393e25d0e6723c9ed6e7542b.diff
LOG: [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
Added:
Modified:
mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp b/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
index 5e3a60d74506..5a974bc9365e 100644
--- a/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
+++ b/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
@@ -55,8 +55,7 @@ class BinaryOpConversion : public OpConversionPattern<SrcOpTy> {
matchAndRewrite(SrcOpTy op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
typename SrcOpTy::Adaptor adaptor(operands);
- rewriter.replaceOpWithNewOp<DstOpTy>(op.getOperation(), adaptor.lhs(),
- adaptor.rhs());
+ rewriter.replaceOpWithNewOp<DstOpTy>(op, adaptor.lhs(), adaptor.rhs());
return success();
}
};
@@ -123,8 +122,7 @@ class ConstSizeOpConverter : public OpConversionPattern<ConstSizeOp> {
LogicalResult ConstSizeOpConverter::matchAndRewrite(
ConstSizeOp op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const {
- rewriter.replaceOpWithNewOp<ConstantIndexOp>(op.getOperation(),
- op.value().getSExtValue());
+ rewriter.replaceOpWithNewOp<ConstantIndexOp>(op, op.value().getSExtValue());
return success();
}
@@ -171,7 +169,7 @@ LogicalResult
RankOpConverter::matchAndRewrite(shape::RankOp op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const {
shape::RankOp::Adaptor transformed(operands);
- rewriter.replaceOpWithNewOp<DimOp>(op.getOperation(), transformed.shape(), 0);
+ rewriter.replaceOpWithNewOp<DimOp>(op, transformed.shape(), 0);
return success();
}
More information about the Mlir-commits
mailing list