[clang] [CIR][NFC] Remove redundant pointer casts (PR #139898)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Wed May 14 06:30:52 PDT 2025


https://github.com/xlauko created https://github.com/llvm/llvm-project/pull/139898

This mirrors incubator changes from https://github.com/llvm/clangir/pull/1609

>From d83f57555c2c7357131d7527f1a04d0e3558af43 Mon Sep 17 00:00:00 2001
From: xlauko <xlauko at mail.muni.cz>
Date: Wed, 14 May 2025 15:30:05 +0200
Subject: [PATCH] [CIR][NFC] Remove redundant pointer casts

This mirrors incubator changes from https://github.com/llvm/clangir/pull/1609
---
 clang/include/clang/CIR/Dialect/IR/CIROps.td | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index 9f5fa266742e8..e08f372450285 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -269,7 +269,7 @@ def PtrStrideOp : CIR_Op<"ptr_stride",
   let extraClassDeclaration = [{
     // Get type pointed by the base pointer.
     mlir::Type getElementTy() {
-      return mlir::cast<cir::PointerType>(getBase().getType()).getPointee();
+      return getBase().getType().getPointee();
     }
   }];
 }
@@ -1710,7 +1710,7 @@ def GetMemberOp : CIR_Op<"get_member"> {
 
     /// Return the result type.
     cir::PointerType getResultTy() {
-      return mlir::cast<cir::PointerType>(getResult().getType());
+      return getResult().getType();
     }
   }];
 



More information about the cfe-commits mailing list