[Mlir-commits] [mlir] 64d514a - [mlir] Fix -Wdeprecated-declarations of cast in VCIXToLLVMIRTranslation.cpp (NFC)

Jie Fu llvmlistbot at llvm.org
Fri Apr 26 08:28:10 PDT 2024


Author: Jie Fu
Date: 2024-04-26T23:26:44+08:00
New Revision: 64d514a2e1f1396d54bca0597b1e8b4e580bfd7b

URL: https://github.com/llvm/llvm-project/commit/64d514a2e1f1396d54bca0597b1e8b4e580bfd7b
DIFF: https://github.com/llvm/llvm-project/commit/64d514a2e1f1396d54bca0597b1e8b4e580bfd7b.diff

LOG: [mlir] Fix -Wdeprecated-declarations of cast in VCIXToLLVMIRTranslation.cpp (NFC)

In file included from /llvm-project/mlir/lib/Target/LLVMIR/Dialect/VCIX/VCIXToLLVMIRTranslation.cpp:70:
/llvm-project/build-Release/tools/mlir/include/mlir/Dialect/LLVMIR/VCIXConversions.inc:8:48: error: 'cast' is deprecated: Use mlir::cast<U>() instead [-Werror,-Wdeprecated-declarations]
      VectorType vt = op.getResult().getType().cast<VectorType>();
                                               ^
/llvm-project/mlir/include/mlir/IR/Types.h:345:9: note: 'cast' has been explicitly marked deprecated here
U Type::cast() const {
        ^
In file included from /llvm-project/mlir/lib/Target/LLVMIR/Dialect/VCIX/VCIXToLLVMIRTranslation.cpp:70:
/llvm-project/build-Release/tools/mlir/include/mlir/Dialect/LLVMIR/VCIXConversions.inc:8:48: error: 'cast<mlir::VectorType>' is deprecated: Use mlir::cast<U>() instead [-Werror,-Wdeprecated-declarations]
      VectorType vt = op.getResult().getType().cast<VectorType>();
                                               ^
/llvm-project/mlir/include/mlir/IR/Types.h:112:5: note: 'cast<mlir::VectorType>' has been explicitly marked deprecated here
  [[deprecated("Use mlir::cast<U>() instead")]]
    ^
In file included from /llvm-project/mlir/lib/Target/LLVMIR/Dialect/VCIX/VCIXToLLVMIRTranslation.cpp:70:
/llvm-project/build-Release/tools/mlir/include/mlir/Dialect/LLVMIR/VCIXConversions.inc:32:48: error: 'cast' is deprecated: Use mlir::cast<U>() instead [-Werror,-Wdeprecated-declarations]
      VectorType vt = op.getResult().getType().cast<VectorType>();
                                               ^
/llvm-project/mlir/include/mlir/IR/Types.h:345:9: note: 'cast' has been explicitly marked deprecated here
U Type::cast() const {
        ^
In file included from /llvm-project/mlir/lib/Target/LLVMIR/Dialect/VCIX/VCIXToLLVMIRTranslation.cpp:70:
/llvm-project/build-Release/tools/mlir/include/mlir/Dialect/LLVMIR/VCIXConversions.inc:32:48: error: 'cast<mlir::VectorType>' is deprecated: Use mlir::cast<U>() instead [-Werror,-Wdeprecated-declarations]
      VectorType vt = op.getResult().getType().cast<VectorType>();
                                               ^
/llvm-project/mlir/include/mlir/IR/Types.h:112:5: note: 'cast<mlir::VectorType>' has been explicitly marked deprecated here
  [[deprecated("Use mlir::cast<U>() instead")]]
    ^
4 errors generated.

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/LLVMIR/VCIXOps.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/LLVMIR/VCIXOps.td b/mlir/include/mlir/Dialect/LLVMIR/VCIXOps.td
index 25c1d027768af2..27d9a32dd8e031 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/VCIXOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/VCIXOps.td
@@ -78,7 +78,7 @@ def VCIX_BinaryImmOp : VCIX_Op<"v.iv">,
           xlen, $opcode, $_location, moduleTranslation);
       llvm::Value *immConst = mlir::LLVM::detail::getLLVMConstant(
           xlen, $imm, $_location, moduleTranslation);
-      VectorType vt = op.getResult().getType().cast<VectorType>();
+      VectorType vt = mlir::cast<VectorType>(op.getResult().getType());
       llvm::Value *vl =
           createVL(builder, $vl, vt, xlen, $_location, moduleTranslation);
       $res = createIntrinsicCall(
@@ -120,7 +120,7 @@ def VCIX_BinaryOp : VCIX_Op<"v.sv">,
       } else {
         id = llvm::Intrinsic::riscv_sf_vc_v_fv_se;
       }
-      VectorType vt = op.getResult().getType().cast<VectorType>();
+      VectorType vt = mlir::cast<VectorType>(op.getResult().getType());
       llvm::Value *vl =
           createVL(builder, $vl, vt, xlen, $_location, moduleTranslation);
       $res = createIntrinsicCall(


        


More information about the Mlir-commits mailing list