diff options
author | Christian Sigg <chsigg@users.noreply.github.com> | 2024-04-28 22:01:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-28 22:01:42 +0200 |
commit | fac349a169976f822fb27f03e623fa0d28aec1f3 (patch) | |
tree | 36b7f1c1455e9d93153868158260072a3875077a /flang/lib/Optimizer/CodeGen/TargetRewrite.cpp | |
parent | c9dae43438897590a21edbc89003bd6704659c7c (diff) | |
download | llvm-fac349a169976f822fb27f03e623fa0d28aec1f3.zip llvm-fac349a169976f822fb27f03e623fa0d28aec1f3.tar.gz llvm-fac349a169976f822fb27f03e623fa0d28aec1f3.tar.bz2 |
Reapply "[mlir] Mark `isa/dyn_cast/cast/...` member functions depreca… (#90406)
…ted. (#89998)" (#90250)
This partially reverts commit 7aedd7dc754c74a49fe84ed2640e269c25414087.
This change removes calls to the deprecated member functions. It does
not mark the functions deprecated yet and does not disable the
deprecation warning in TypeSwitch. This seems to cause problems with
MSVC.
Diffstat (limited to 'flang/lib/Optimizer/CodeGen/TargetRewrite.cpp')
-rw-r--r-- | flang/lib/Optimizer/CodeGen/TargetRewrite.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp b/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp index 7bf31ec..616de78 100644 --- a/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp +++ b/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp @@ -137,7 +137,7 @@ public: if (!hasPortableSignature(dispatch.getFunctionType(), op)) convertCallOp(dispatch); } else if (auto addr = mlir::dyn_cast<fir::AddrOfOp>(op)) { - if (addr.getType().isa<mlir::FunctionType>() && + if (mlir::isa<mlir::FunctionType>(addr.getType()) && !hasPortableSignature(addr.getType(), op)) convertAddrOp(addr); } @@ -601,7 +601,7 @@ public: /// Taking the address of a function. Modify the signature as needed. void convertAddrOp(fir::AddrOfOp addrOp) { rewriter->setInsertionPoint(addrOp); - auto addrTy = addrOp.getType().cast<mlir::FunctionType>(); + auto addrTy = mlir::cast<mlir::FunctionType>(addrOp.getType()); fir::CodeGenSpecifics::Marshalling newInTyAndAttrs; llvm::SmallVector<mlir::Type> newResTys; auto loc = addrOp.getLoc(); @@ -705,22 +705,23 @@ public: /// return `true`. Otherwise, the signature is not portable and `false` is /// returned. bool hasPortableSignature(mlir::Type signature, mlir::Operation *op) { - assert(signature.isa<mlir::FunctionType>()); - auto func = signature.dyn_cast<mlir::FunctionType>(); + assert(mlir::isa<mlir::FunctionType>(signature)); + auto func = mlir::dyn_cast<mlir::FunctionType>(signature); bool hasCCallingConv = isFuncWithCCallingConvention(op); for (auto ty : func.getResults()) - if ((ty.isa<fir::BoxCharType>() && !noCharacterConversion) || + if ((mlir::isa<fir::BoxCharType>(ty) && !noCharacterConversion) || (fir::isa_complex(ty) && !noComplexConversion) || - (ty.isa<mlir::IntegerType>() && hasCCallingConv)) { + (mlir::isa<mlir::IntegerType>(ty) && hasCCallingConv)) { LLVM_DEBUG(llvm::dbgs() << "rewrite " << signature << " for target\n"); return false; } for (auto ty : func.getInputs()) - if (((ty.isa<fir::BoxCharType>() || fir::isCharacterProcedureTuple(ty)) && + if (((mlir::isa<fir::BoxCharType>(ty) || + fir::isCharacterProcedureTuple(ty)) && !noCharacterConversion) || (fir::isa_complex(ty) && !noComplexConversion) || - (ty.isa<mlir::IntegerType>() && hasCCallingConv) || - (ty.isa<fir::RecordType>() && !noStructConversion)) { + (mlir::isa<mlir::IntegerType>(ty) && hasCCallingConv) || + (mlir::isa<fir::RecordType>(ty) && !noStructConversion)) { LLVM_DEBUG(llvm::dbgs() << "rewrite " << signature << " for target\n"); return false; } @@ -740,7 +741,7 @@ public: /// Rewrite the signatures and body of the `FuncOp`s in the module for /// the immediately subsequent target code gen. void convertSignature(mlir::func::FuncOp func) { - auto funcTy = func.getFunctionType().cast<mlir::FunctionType>(); + auto funcTy = mlir::cast<mlir::FunctionType>(func.getFunctionType()); if (hasPortableSignature(funcTy, func) && !hasHostAssociations(func)) return; llvm::SmallVector<mlir::Type> newResTys; |