[all-commits] [llvm/llvm-project] a75565: [mlir] Execute same operand name constraints befor...

Chenguang Wang via All-commits all-commits at lists.llvm.org
Thu Oct 9 16:20:09 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a75565a54401571b896e1a3c60939e4dcdc0b13a
      https://github.com/llvm/llvm-project/commit/a75565a54401571b896e1a3c60939e4dcdc0b13a
  Author: Chenguang Wang <w3cing at gmail.com>
  Date:   2025-10-09 (Thu, 09 Oct 2025)

  Changed paths:
    M mlir/test/lib/Dialect/Test/TestOps.td
    M mlir/test/lib/Dialect/Test/TestPatterns.cpp
    M mlir/test/mlir-tblgen/pattern.mlir
    M mlir/tools/mlir-tblgen/RewriterGen.cpp

  Log Message:
  -----------
  [mlir] Execute same operand name constraints before user constraints. (#162526)

For a pattern like this:

    Pat<(MyOp $x, $x),
        (...),
        [(MyCheck $x)]>;

The old implementation generates:

    Pat<(MyOp $x0, $x1),
        (...),
        [(MyCheck $x0),
         ($x0 == $x1)]>;

This is not very straightforward, because the $x name appears in the
source pattern; it's attempting to assume equality check will be
performed as part of the source pattern matching.

This commit moves the equality checks before the other constraints,
i.e.:

    Pat<(MyOp $x0, $x1),
        (...),
        [($x0 == $x1),
         (MyCheck $x0)]>;



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list