[Mlir-commits] [mlir] [MLIR Attr] add ArrayMaxCount (PR #92453)

Ryan Thomas Lynch llvmlistbot at llvm.org
Thu May 16 13:55:31 PDT 2024


https://github.com/emosy created https://github.com/llvm/llvm-project/pull/92453

this is the dual of ArrayMinCount. I saw that I needed it but it didn't exist yet

>From 6b87e49c98dd66103f886217b33e4b7052da4156 Mon Sep 17 00:00:00 2001
From: Ryan Thomas Lynch <rlynch34 at gatech.edu>
Date: Thu, 16 May 2024 20:54:09 +0000
Subject: [PATCH] [MLIR Attr] add ArrayMaxCount

this is the dual of ArrayMinCount. I saw that I needed it but it didn't exist yet
---
 mlir/include/mlir/IR/CommonAttrConstraints.td | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mlir/include/mlir/IR/CommonAttrConstraints.td b/mlir/include/mlir/IR/CommonAttrConstraints.td
index 0d69bb0717a59..d99bde1f87ef0 100644
--- a/mlir/include/mlir/IR/CommonAttrConstraints.td
+++ b/mlir/include/mlir/IR/CommonAttrConstraints.td
@@ -773,6 +773,10 @@ def IntPositive : AttrConstraint<
     CPred<"::llvm::cast<::mlir::IntegerAttr>($_self).getValue().isStrictlyPositive()">,
     "whose value is positive">;
 
+class ArrayMaxCount<int n> : AttrConstraint<
+    CPred<"::llvm::cast<::mlir::ArrayAttr>($_self).size() <= " # n>,
+    "with at most " # n # " elements">;
+
 class ArrayMinCount<int n> : AttrConstraint<
     CPred<"::llvm::cast<::mlir::ArrayAttr>($_self).size() >= " # n>,
     "with at least " # n # " elements">;



More information about the Mlir-commits mailing list