[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
This commit is contained in:
Frederik Gossen 2020-07-24 10:46:40 +00:00
parent 23a65648c0
commit 274db1d21a
1 changed files with 3 additions and 5 deletions

View File

@ -55,8 +55,7 @@ public:
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 @@ public:
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();
}