[Mlir-commits] [mlir] Fix support for complex types in `transform.structured.pad` (PR #139841)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Tue May 20 00:30:04 PDT 2025


================
@@ -1922,7 +1923,14 @@ transform::PadOp::apply(transform::TransformRewriter &rewriter,
         continue;
       }
       // Otherwise, add the attribute directly.
-      if (attr.getType() != elementType) {
+      if (isa<TypedAttr>(attr) &&
+          cast<TypedAttr>(attr).getType() != elementType) {
----------------
ftynse wrote:

`isa` followed by `cast` is an explicit anti-pattern in LLVM, please use `dyn_cast` combined with c++17 feature of declaring a value inside `if`.

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


More information about the Mlir-commits mailing list