Skip to content

Commit ea3168a

Browse files
TFRT teamcopybara-github
authored andcommitted
Use llvm::cast/dyn_cast/isa since alternatives are deprecated in llvm/llvm-project#135556
PiperOrigin-RevId: 749057356
1 parent f16b1e1 commit ea3168a

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

include/tfrt/basic_kernels/opdefs/basic_kernels.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ class ConstantOp<string suffix, Type baseType, Attr attr>
8989
def F16Attr : FloatAttrBase<F16, "16-bit float attribute">;
9090
def BF16Attr : TypedAttrBase<
9191
BF16, "FloatAttr",
92-
And<[CPred<"$_self.isa<::mlir::FloatAttr>()">,
93-
CPred<"$_self.cast<::mlir::FloatAttr>().getType().isBF16()">]>,
92+
And<[CPred<"llvm::isa<::mlir::FloatAttr>($_self)">,
93+
CPred<"llvm::cast<::mlir::FloatAttr>($_self).getType().isBF16()">]>,
9494
"bfloat16 attribute"> {
9595
let returnType = [{ ::llvm::APFloat }];
9696
}

include/tfrt/basic_kernels/opdefs/tfrt_base.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@ def TFRT_Dialect : Dialect {
3838
}
3939

4040
def TFRT_ChainType :
41-
Type<CPred<"$_self.isa<tfrt::compiler::ChainType>()">, "!tfrt.chain type">,
41+
Type<CPred<"llvm::isa<tfrt::compiler::ChainType>($_self)">, "!tfrt.chain type">,
4242
BuildableType<"$_builder.getType<tfrt::compiler::ChainType>()">;
4343

4444
def TFRT_StringType :
45-
Type<CPred<"$_self.isa<tfrt::compiler::StringType>()">, "!tfrt.string type">,
45+
Type<CPred<"llvm::isa<tfrt::compiler::StringType>($_self)">, "!tfrt.string type">,
4646
BuildableType<"$_builder.getType<tfrt::compiler::StringType>()">;
4747

4848
def TFRT_TensorTypeType :
49-
Type<CPred<"$_self.isa<tfrt::compiler::TensorTypeType>()">, "!tfrt.tensor_type type">,
49+
Type<CPred<"llvm::isa<tfrt::compiler::TensorTypeType>($_self)">, "!tfrt.tensor_type type">,
5050
BuildableType<"$_builder.getType<tfrt::compiler::TensorTypeType>()">;
5151

5252
def TFRT_DeviceType :
53-
Type<CPred<"$_self.isa<tfrt::compiler::DeviceType>()">, "!tfrt.device type">,
53+
Type<CPred<"llvm::isa<tfrt::compiler::DeviceType>($_self)">, "!tfrt.device type">,
5454
BuildableType<"$_builder.getType<tfrt::compiler::DeviceType>()">;
5555

5656
#endif // TFRT_BASE

include/tfrt/core_runtime/opdefs/corert_base.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ def CoreRT_Dialect : Dialect {
3535
// Deivce is an aggregate of Core Runtime ops. It is passed to corert.executeop
3636
// so that the required Core Runtime can be looked up in this device.
3737
def CoreRT_OpHandlerType :
38-
Type<CPred<"$_self.isa<tfrt::corert::OpHandlerType>()">, "!corert.ophandler type">,
38+
Type<CPred<"isa<tfrt::corert::OpHandlerType>($_self)">, "!corert.ophandler type">,
3939
BuildableType<"$_builder.getType<tfrt::corert::OpHandlerType>()">;
4040

4141
// TensorHandle is the currency type for Core Runtime execution.
4242
def CoreRT_TensorHandleType:
43-
Type<CPred<"$_self.isa<tfrt::corert::TensorHandleType>()">, "!corert.tensorhandle type">,
43+
Type<CPred<"isa<tfrt::corert::TensorHandleType>($_self)">, "!corert.tensorhandle type">,
4444
BuildableType<"$_builder.getType<tfrt::corert::TensorHandleType>()">;
4545

4646
#endif

include/tfrt/tensor/opdefs/host_tensor.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def HostTensor_Dialect : Dialect {
4343
// Type definitions
4444
//===----------------------------------------------------------------------===//
4545
def HostBufferType : DialectType<HostTensor_Dialect,
46-
CPred<"$_self.isa<::tfrt::ht::HostBufferType>()">, "!ht.host_buffer type">,
46+
CPred<"llvm::isa<::tfrt::ht::HostBufferType>($_self)">, "!ht.host_buffer type">,
4747
BuildableType<"$_builder.getType<::tfrt::ht::HostBufferType>()"> {
4848
let description = [{
4949
`!ht.host_buffer type` represents a host buffer.

include/tfrt/tensor/opdefs/tensor.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def Tensor_Dialect : Dialect {
4242
// Type definitions
4343
//===----------------------------------------------------------------------===//
4444
def TensorType : DialectType<Tensor_Dialect,
45-
CPred<"$_self.isa<::tfrt::tfrt_tensor::TensorType>()">, "!tfrt_tensor.tensor type">,
45+
CPred<"llvm::isa<::tfrt::tfrt_tensor::TensorType>($_self)">, "!tfrt_tensor.tensor type">,
4646
BuildableType<"$_builder.getType<::tfrt::tfrt_tensor::TensorType>()"> {
4747
let description = [{
4848
`!trft_tensor.tensor type` represents a generic tfrt tensor.

include/tfrt/tensor/opdefs/tensor_shape_base.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ def TensorShapeDialect : Dialect {
3939

4040
// Type definition.
4141
def TS_Shape : DialectType<TensorShapeDialect,
42-
CPred<"$_self.isa<::tfrt::ts::ShapeType>()">, "!ts.shape type">,
42+
CPred<"llvm::isa<::tfrt::ts::ShapeType>($_self)">, "!ts.shape type">,
4343
BuildableType<"$_builder.getType<::tfrt::ts::ShapeType>()"> {
4444
let description = [{
4545
`!ts.shape type` represents a static tensor shape.
4646
}];
4747
}
4848

4949
def TS_PartialShape : DialectType<TensorShapeDialect,
50-
CPred<"$_self.isa<::tfrt::ts::PartialShapeType>()">, "!ts.partial_shape type">,
50+
CPred<"llvm::isa<::tfrt::ts::PartialShapeType>($_self)">, "!ts.partial_shape type">,
5151
BuildableType<"$_builder.getType<::tfrt::ts::PartialShapeType>()"> {
5252
let description = [{
5353
`!ts.partial_shape type` represents either a static tensor shape, unranked

lib/bef_converter/mlir_to_bef/bef_location_emitter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ bool BefLocationEmitter::IsSupportedLocation(const mlir::Location& loc) {
2828
if (llvm::isa<mlir::UnknownLoc>(loc)) return true;
2929
if (llvm::isa<mlir::NameLoc>(loc)) return true;
3030
if (llvm::isa<mlir::FileLineColLoc>(loc)) return true;
31-
if (auto callsite_loc = loc.dyn_cast<mlir::CallSiteLoc>()) {
31+
if (auto callsite_loc = llvm::dyn_cast<mlir::CallSiteLoc>(loc)) {
3232
return IsSupportedLocation(callsite_loc.getCallee()) &&
3333
IsSupportedLocation(callsite_loc.getCaller());
3434
}

0 commit comments

Comments
 (0)