[Mlir-commits] [mlir] [MLIR][Transform] Add attribute in MatchOp to filter by operand type (PR #67994)

Matthias Springer llvmlistbot at llvm.org
Fri Dec 1 17:51:34 PST 2023


================
@@ -1180,12 +1181,34 @@ transform::MatchOp::apply(transform::TransformRewriter &rewriter,
         return;
     }
 
+    if (getFilterOperandTypes().has_value()) {
+      mlir::ArrayAttr types = getFilterOperandTypes().value();
+      auto operandTypes = op->getOperandTypes();
+      if (types.size() != operandTypes.size()) {
+        wrong_operand_filter = true;
+        return;
+      }
+
+      for (auto const &it :
+           llvm::zip(getFilterOperandTypes().value(), operandTypes)) {
+        auto attr = dyn_cast<mlir::TypeAttr>(std::get<0>(it));
+        Type type = attr.getValue().cast<::mlir::Type>();
+        Type t = getElementTypeOrSelf(std::get<1>(it));
----------------
matthias-springer wrote:

I think there should be no `getElementTypeOrSelf`.

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


More information about the Mlir-commits mailing list