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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Oct 19 22:07:21 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-linalg

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

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


---
Full diff: https://github.com/llvm/llvm-project/pull/233681.diff


2 Files Affected:

- (modified) mlir/lib/Dialect/Linalg/Transforms/PadTilingInterface.cpp (+1-1) 
- (modified) mlir/test/lib/Dialect/Test/TestOps.td (+1-1) 


``````````diff
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");

``````````

</details>


https://github.com/llvm/llvm-project/pull/233681


More information about the Mlir-commits mailing list