Use mlir::OpState::operator->() to get to methods of mlir::Operation.

This is a preparation step to remove those methods from OpState.

PiperOrigin-RevId: 360043992
This commit is contained in:
Christian Sigg 2021-02-28 09:01:26 -08:00 committed by TensorFlow MLIR Team
parent 006b58c476
commit 2d818c4fd9
1 changed files with 5 additions and 5 deletions

View File

@ -126,7 +126,7 @@ struct ElementwiseOpConversion : public OpRewritePattern<OpTy> {
Type flatResultTy = Type flatResultTy =
RankedTensorType::get({ShapedType::kDynamicSize}, resultElementTy); RankedTensorType::get({ShapedType::kDynamicSize}, resultElementTy);
Value flatResult = Value flatResult =
rewriter.create<OpTy>(loc, flatResultTy, flatOperands, op.getAttrs()); rewriter.create<OpTy>(loc, flatResultTy, flatOperands, op->getAttrs());
// Restore original shape. // Restore original shape.
rewriter.replaceOpWithNewOp<mhlo::DynamicReshapeOp>(op, op.getType(), rewriter.replaceOpWithNewOp<mhlo::DynamicReshapeOp>(op, op.getType(),
@ -192,7 +192,7 @@ struct ConvertUnrankedScalarDynamicBroadcastBinaryOp
rhs_is_scalar ? rhs : reshaped}; rhs_is_scalar ? rhs : reshaped};
Value computed = rewriter.create<ChloOpTy>( Value computed = rewriter.create<ChloOpTy>(
loc, TypeRange{RankedTensorType::get({-1}, result_element_type)}, loc, TypeRange{RankedTensorType::get({-1}, result_element_type)},
new_operands, op.getAttrs()); new_operands, op->getAttrs());
// Reshape the result back into an unranked tensor. // Reshape the result back into an unranked tensor.
rewriter.replaceOpWithNewOp<mhlo::DynamicReshapeOp>(op, result_type, rewriter.replaceOpWithNewOp<mhlo::DynamicReshapeOp>(op, result_type,
@ -278,7 +278,7 @@ struct ConvertUnrankedDynamicBroadcastOpHelper {
auto result_type = auto result_type =
RankedTensorType::get(dynamic_dimensions, result_element_type); RankedTensorType::get(dynamic_dimensions, result_element_type);
Value result = if_builder.create<ChloOpTy>( Value result = if_builder.create<ChloOpTy>(
loc, ArrayRef<Type>{result_type}, reshaped_operands, op.getAttrs()); loc, ArrayRef<Type>{result_type}, reshaped_operands, op->getAttrs());
Value reshaped_result = if_builder.create<tensor::CastOp>( Value reshaped_result = if_builder.create<tensor::CastOp>(
loc, UnrankedTensorType::get(result_element_type), result); loc, UnrankedTensorType::get(result_element_type), result);
if_builder.create<scf::YieldOp>(loc, reshaped_result); if_builder.create<scf::YieldOp>(loc, reshaped_result);
@ -386,7 +386,7 @@ struct ConvertUnrankedDynamicBroadcastBinaryOp
loc, RankedTensorType::get({}, lhs_type.getElementType()), lhs); loc, RankedTensorType::get({}, lhs_type.getElementType()), lhs);
Value if_lhs_scalar_result = if_lhs_scalar_builder.create<ChloOpTy>( Value if_lhs_scalar_result = if_lhs_scalar_builder.create<ChloOpTy>(
loc, ArrayRef<Type>{result_type}, ArrayRef<Value>{reshaped_lhs, rhs}, loc, ArrayRef<Type>{result_type}, ArrayRef<Value>{reshaped_lhs, rhs},
op.getAttrs()); op->getAttrs());
Value extended_if_lhs_scalar_result = Value extended_if_lhs_scalar_result =
extendToBroadcastShape(if_lhs_scalar_builder, loc, if_lhs_scalar_result, extendToBroadcastShape(if_lhs_scalar_builder, loc, if_lhs_scalar_result,
shape_of_lhs, shape_of_rhs); shape_of_lhs, shape_of_rhs);
@ -409,7 +409,7 @@ struct ConvertUnrankedDynamicBroadcastBinaryOp
loc, RankedTensorType::get({}, rhs_type.getElementType()), rhs); loc, RankedTensorType::get({}, rhs_type.getElementType()), rhs);
Value if_rhs_scalar_result = if_rhs_scalar_builder.create<ChloOpTy>( Value if_rhs_scalar_result = if_rhs_scalar_builder.create<ChloOpTy>(
loc, ArrayRef<Type>{result_type}, ArrayRef<Value>{lhs, reshaped_rhs}, loc, ArrayRef<Type>{result_type}, ArrayRef<Value>{lhs, reshaped_rhs},
op.getAttrs()); op->getAttrs());
Value extended_if_rhs_scalar_result = Value extended_if_rhs_scalar_result =
extendToBroadcastShape(if_rhs_scalar_builder, loc, if_rhs_scalar_result, extendToBroadcastShape(if_rhs_scalar_builder, loc, if_rhs_scalar_result,
shape_of_lhs, shape_of_rhs); shape_of_lhs, shape_of_rhs);