[Mlir-commits] [mlir] ce62b18 - [mlir] Replace PointerUnion::dyn_cast with llvm::dyn_cast (NFC) (#233681)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Oct 20 01:11:23 PDT 2026


Author: Kazu Hirata
Date: 2026-10-20T01:11:18-07:00
New Revision: ce62b185c8b19edc5cf2410ce3811b177a9177e3

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

LOG: [mlir] Replace PointerUnion::dyn_cast with llvm::dyn_cast (NFC) (#233681)

PointerUnion::dyn_cast has been soft-deprecated.  This patch replaces it
with llvm::dyn_cast:

- PadTilingInterface.cpp: Each OpFoldResult in paddedShape is a
  nonnull Attribute or Value, and dynamic dimensions must be valid
  Values.
- TestOps.td: CallWithSegmentsOp::setCalleeFromCallable is an unused
  CallOpInterface implementation on a test op.

This patch completes the migration away from PointerUnion::dyn_cast
under mlir/.

Assisted-by: Antigravity

Added: 
    

Modified: 
    mlir/lib/Dialect/Linalg/Transforms/PadTilingInterface.cpp
    mlir/test/lib/Dialect/Test/TestOps.td

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Linalg/Transforms/PadTilingInterface.cpp b/mlir/lib/Dialect/Linalg/Transforms/PadTilingInterface.cpp
index 8c6ad2e65bd79..c87b8f4ad6bac 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/PadTilingInterface.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/PadTilingInterface.cpp
@@ -254,7 +254,7 @@ static Value padOperand(OpBuilder &builder, TilingInterface opToPad,
     std::optional<int64_t> cst = getConstantIntValue(ofr);
     tensorShape.push_back(cst.has_value() ? *cst : ShapedType::kDynamic);
     if (!cst.has_value())
-      dynDims.push_back(ofr.dyn_cast<Value>());
+      dynDims.push_back(dyn_cast<Value>(ofr));
   }
   // TODO: use dispatchIndexOpFoldResults(paddedShape, dynDims, paddedShape);
 

diff  --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td
index f95d4419a83ad..0a64885d8e292 100644
--- a/mlir/test/lib/Dialect/Test/TestOps.td
+++ b/mlir/test/lib/Dialect/Test/TestOps.td
@@ -4884,7 +4884,7 @@ def CallWithSegmentsOp : TEST_Op<"call_with_segments",
       return ::mlir::CallInterfaceCallable();
     }
     void $cppClass::setCalleeFromCallable(::mlir::CallInterfaceCallable callee) {
-      if (auto sym = callee.dyn_cast<::mlir::SymbolRefAttr>())
+      if (auto sym = dyn_cast<::mlir::SymbolRefAttr>(callee))
         (*this)->setDiscardableAttr("callee", sym);
       else
         (*this)->removeDiscardableAttr("callee");


        


More information about the Mlir-commits mailing list