[Mlir-commits] [mlir] [mlir] Execute same operand name constraints before user constraints. (PR #162526)
    Logan Chien 
    llvmlistbot at llvm.org
       
    Wed Oct  8 11:49:08 PDT 2025
    
    
  
================
@@ -206,6 +209,21 @@ func.func @verifyMultipleEqualArgs(
   return
 }
 
+func.func @verifyEqualArgsCheckBeforeUserConstraints(%arg0: i32, %arg1: f32) {
+  // def TestEqualArgsCheckBeforeUserConstraintsPattern :
+  //   Pat<(OpQ $x, $x),
----------------
loganchien wrote:
Maybe:
```
Pat<(OpQ:$op $x, $x),
    (replaceWithValue $x),
    [(AssertOperandsAreSame $op)]>;
```
and inside `AssertOpreandsAreSame` we simply put a fatal error.
```
bool AssertOperandsAreSame(Value op) {
  Operation* operation = op.getDefiningOp();
  if (operation->getOperand(0) != operation->getOpearnd(1)) {
    // Name binding equality check must happen before user-defined constraints, thus this must not be triggered.
    llvm::report_fatal_error(...);
  }
  return true;
}
```
https://github.com/llvm/llvm-project/pull/162526
    
    
More information about the Mlir-commits
mailing list