[Mlir-commits] [mlir] [mlir] Execute same operand name constraints before user constraints. (PR #162526)
Chenguang Wang
llvmlistbot at llvm.org
Wed Oct 8 12:44:11 PDT 2025
================
@@ -1024,6 +1024,32 @@ void PatternEmitter::emitMatchLogic(DagNode tree, StringRef opName) {
int depth = 0;
emitMatch(tree, opName, depth);
+ // Some of the operands could be bound to the same symbol name, we need
+ // to enforce equality constraint on those.
+ // This has to happen before user provided constraints, which may assume the
+ // same name checks are already performed, since in the pattern source code
+ // the user provided constraints appear later.
+ // TODO: we should be able to emit equality checks early
----------------
wecing wrote:
>From https://reviews.llvm.org/D89254:
> Gotcha, perhaps leave a TODO. It would seem that if we had
>
> (X $x, $x, .... (Y $x, ...) ....)
>
> we could have exited early once inspecting the 2nd operand, while here we'd try to verify the entire match before considering this equality
So this TODO is about interleaving the check into the tree matching process.
https://github.com/llvm/llvm-project/pull/162526
More information about the Mlir-commits
mailing list