diff options
| author | Lei Zhang <antiagainst@google.com> | 2019-12-02 07:54:23 -0800 |
|---|---|---|
| committer | A. Unique TensorFlower <gardener@tensorflow.org> | 2019-12-02 07:54:50 -0800 |
| commit | 4982eaf87cf879fe47173ce640f87b7f9f103b73 (patch) | |
| tree | 4557cda78835b73f076c8764f521d08ca0153e43 /mlir/lib/TableGen | |
| parent | 0d22a3fdc87cb8e96a73cb427c6621c405c4674e (diff) | |
| download | bcm5719-llvm-4982eaf87cf879fe47173ce640f87b7f9f103b73.tar.gz bcm5719-llvm-4982eaf87cf879fe47173ce640f87b7f9f103b73.zip | |
[DRR] Introduce `$_` to ignore op argument match
Right now op argument matching in DRR is position-based, meaning we need to
specify N arguments for an op with N ODS-declared argument. This can be annoying
when we don't want to capture all the arguments. `$_` is to remedy the situation.
PiperOrigin-RevId: 283339992
Diffstat (limited to 'mlir/lib/TableGen')
| -rw-r--r-- | mlir/lib/TableGen/Pattern.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mlir/lib/TableGen/Pattern.cpp b/mlir/lib/TableGen/Pattern.cpp index d3c1dddd21e..098dba3ae6e 100644 --- a/mlir/lib/TableGen/Pattern.cpp +++ b/mlir/lib/TableGen/Pattern.cpp @@ -564,7 +564,8 @@ void tblgen::Pattern::collectBoundSymbols(DagNode tree, SymbolInfoMap &infoMap, // We can only bind symbols to op arguments in source pattern. Those // symbols are referenced in result patterns. auto treeArgName = tree.getArgName(i); - if (!treeArgName.empty()) { + // `$_` is a special symbol meaning ignore the current argument. + if (!treeArgName.empty() && treeArgName != "_") { LLVM_DEBUG(llvm::dbgs() << "found symbol bound to op argument: " << treeArgName << '\n'); if (!infoMap.bindOpArgument(treeArgName, op, i)) { |

