[Mlir-commits] [mlir] [mlir] Add non-attribute property predicates to adaptor verifiers (PR #150881)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Jul 27 22:35:45 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-core

Author: Krzysztof Drewniak (krzysz00)

<details>
<summary>Changes</summary>

When adding a predicated field to non-attribute properties / implemneting PropConstraint, a call to genPropertyVerifiers() wasn't added to the generation sequence for [Op]GenericAdaptor::verify. This commit fixes the issue.

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


1 Files Affected:

- (modified) mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp (+2-1) 


``````````diff
diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
index f35cfa6826388..8ea4eb7b3eeca 100644
--- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
@@ -1127,7 +1127,7 @@ static void genPropertyVerifier(
     body << formatv(fetchProperty, varName, getterName,
                     prop.prop.getInterfaceType());
     auto uniquedFn = staticVerifierEmitter.getPropConstraintFn(prop.prop);
-    if (uniquedFn.has_value())
+    if (uniquedFn.has_value() && emitHelper.isEmittingForOp())
       body << formatv(verifyPropertyUniqued, *uniquedFn, varName, prop.name);
     else
       body << formatv(
@@ -4764,6 +4764,7 @@ void OpOperandAdaptorEmitter::addVerification() {
 
   FmtContext verifyCtx;
   populateSubstitutions(emitHelper, verifyCtx);
+  genPropertyVerifier(emitHelper, verifyCtx, body, staticVerifierEmitter);
   genAttributeVerifier(emitHelper, verifyCtx, body, staticVerifierEmitter,
                        useProperties);
 

``````````

</details>


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


More information about the Mlir-commits mailing list