Skip to content

Commit f16b1e1

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

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,7 @@ tfrt_cc_library(
13201320
":core_runtime_opdefs",
13211321
":tensor_opdefs",
13221322
":test_kernels_opdefs_inc_gen",
1323+
"@llvm-project//llvm:Support",
13231324
"@llvm-project//mlir:FuncDialect",
13241325
"@llvm-project//mlir:IR",
13251326
"@llvm-project//mlir:SideEffectInterfaces",

lib/bef_converter/mlir_to_bef/bef_location_emitter.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ bool BefLocationEmitter::IsSupportedLocation(const mlir::Location& loc) {
3232
return IsSupportedLocation(callsite_loc.getCallee()) &&
3333
IsSupportedLocation(callsite_loc.getCaller());
3434
}
35-
if (auto fused_loc = loc.dyn_cast<mlir::FusedLoc>()) {
35+
if (auto fused_loc = llvm::dyn_cast<mlir::FusedLoc>(loc)) {
3636
for (auto& location : fused_loc.getLocations()) {
3737
if (IsSupportedLocation(location)) return true;
3838
}
@@ -61,13 +61,13 @@ size_t BefLocationEmitter::EmitLocation(const mlir::Location& loc) {
6161
assert(IsSupportedLocation(loc));
6262
const size_t offset = size();
6363

64-
if (auto filelinecol_loc = loc.dyn_cast<mlir::UnknownLoc>()) {
64+
if (auto filelinecol_loc = llvm::dyn_cast<mlir::UnknownLoc>(loc)) {
6565
// Encoding format: `0x00`
6666
EmitByte(static_cast<uint8_t>(BefLocationType::kUnknown));
6767
return offset;
6868
}
6969

70-
if (auto filelinecol_loc = loc.dyn_cast<mlir::FileLineColLoc>()) {
70+
if (auto filelinecol_loc = llvm::dyn_cast<mlir::FileLineColLoc>(loc)) {
7171
// Encoding format: `0x01` FILELINECOL_LOC ::= `0x00` INDEX<"Filename">
7272
// INTEGER<"LineNum"> INTEGER<"ColumnNum">
7373
EmitByte(static_cast<uint8_t>(BefLocationType::kFileLineCol));
@@ -77,23 +77,23 @@ size_t BefLocationEmitter::EmitLocation(const mlir::Location& loc) {
7777
return offset;
7878
}
7979

80-
if (auto name_loc = loc.dyn_cast<mlir::NameLoc>()) {
80+
if (auto name_loc = llvm::dyn_cast<mlir::NameLoc>(loc)) {
8181
// Encoding format: `0x02` INDEX<"Name"> LOCATION<"Child">
8282
EmitByte(static_cast<uint8_t>(BefLocationType::kName));
8383
EmitLocationStringAsVbrOffset(name_loc.getName());
8484
EmitLocation(name_loc.getChildLoc());
8585
return offset;
8686
}
8787

88-
if (auto callsite_loc = loc.dyn_cast<mlir::CallSiteLoc>()) {
88+
if (auto callsite_loc = llvm::dyn_cast<mlir::CallSiteLoc>(loc)) {
8989
// Encoding format: `x003` LOCATION<"Callee"> LOCATION<"Caller">
9090
EmitByte(static_cast<uint8_t>(BefLocationType::kCallSite));
9191
EmitLocation(callsite_loc.getCallee());
9292
EmitLocation(callsite_loc.getCaller());
9393
return offset;
9494
}
9595

96-
if (auto fused_loc = loc.dyn_cast<mlir::FusedLoc>()) {
96+
if (auto fused_loc = llvm::dyn_cast<mlir::FusedLoc>(loc)) {
9797
const size_t location_count = CountSupportedLocations(fused_loc);
9898
if (location_count > 0) {
9999
// Encoding format: `0x04` INTEGER<”NumLocations”> LOCATION*

0 commit comments

Comments
 (0)