[mlir] do not elide dialect prefix for ops with dots in the name
authorAlex Zinenko <zinenko@google.com>
Thu, 19 May 2022 14:13:51 +0000 (16:13 +0200)
committerAlex Zinenko <zinenko@google.com>
Fri, 20 May 2022 10:55:32 +0000 (12:55 +0200)
commit122e685878991b63e414733094e9876e715d08e0
treecd74459e9c6ff3d88e0c618490c6473c9dca87bc
parentb4dd9fc370a1bfd77b1f67172008c351216093a2
[mlir] do not elide dialect prefix for ops with dots in the name

For the hypothetical "a.b.c" op printed within a region that declares "a" as
the default dialect, MLIR would currently elide the "a." prefix and only print
"b.c". However, this becomes ambiguous while parsing as "b.c" may be exist as
the "c" op in the "b" dialect. If it does not, the parsing currently fails. Do
not elide the default dialect if the op name contains further dots to avoid the
ambiguity.

See https://discourse.llvm.org/t/dropping-dialect-prefix-for-ops-with-multiple-dots-in-the-name/62562

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D125975
mlir/lib/IR/AsmPrinter.cpp
mlir/lib/IR/Operation.cpp
mlir/test/IR/parser.mlir
mlir/test/lib/Dialect/Test/TestDialect.cpp
mlir/test/lib/Dialect/Test/TestOps.td