[Mlir-commits] [mlir] [MLIR Attr] add ArrayMaxCount attribute constraint (PR #92453)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu May 16 13:55:58 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-core
Author: Ryan Thomas Lynch (emosy)
<details>
<summary>Changes</summary>
this is the dual of ArrayMinCount. I saw that I needed it but it didn't exist yet
---
Full diff: https://github.com/llvm/llvm-project/pull/92453.diff
1 Files Affected:
- (modified) mlir/include/mlir/IR/CommonAttrConstraints.td (+4)
``````````diff
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">;
``````````
</details>
https://github.com/llvm/llvm-project/pull/92453
More information about the Mlir-commits
mailing list