[Mlir-commits] [mlir] 9006bf4 - Remove obsolete `getAsmResultNames` from OpAsmDialectInterface
Mehdi Amini
llvmlistbot at llvm.org
Thu Jan 20 21:58:46 PST 2022
Author: Mehdi Amini
Date: 2022-01-21T05:58:32Z
New Revision: 9006bf424847bf91f0a624ffc27ad165c7b804c4
URL: https://github.com/llvm/llvm-project/commit/9006bf424847bf91f0a624ffc27ad165c7b804c4
DIFF: https://github.com/llvm/llvm-project/commit/9006bf424847bf91f0a624ffc27ad165c7b804c4.diff
LOG: Remove obsolete `getAsmResultNames` from OpAsmDialectInterface
This is superseded by the same method on OpAsmOpInterface, which is
available on the Dialect through the Fallback mechanism,
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D117750
Added:
Modified:
mlir/include/mlir/IR/OpImplementation.h
mlir/lib/IR/AsmPrinter.cpp
mlir/test/IR/parser.mlir
mlir/test/lib/Dialect/Test/TestDialect.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/IR/OpImplementation.h b/mlir/include/mlir/IR/OpImplementation.h
index 56e7c72093219..77e858e484be7 100644
--- a/mlir/include/mlir/IR/OpImplementation.h
+++ b/mlir/include/mlir/IR/OpImplementation.h
@@ -1350,10 +1350,6 @@ class OpAsmDialectInterface
return AliasResult::NoAlias;
}
- /// Get a special name to use when printing the given operation. See
- /// OpAsmInterface.td#getAsmResultNames for usage details and documentation.
- virtual void getAsmResultNames(Operation *op,
- OpAsmSetValueNameFn setNameFn) const {}
};
} // namespace mlir
diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp
index 6875aca46fcd2..f69d147c51b38 100644
--- a/mlir/lib/IR/AsmPrinter.cpp
+++ b/mlir/lib/IR/AsmPrinter.cpp
@@ -797,8 +797,7 @@ class SSANameState {
/// A sentinel value used for values with names set.
enum : unsigned { NameSentinel = ~0U };
- SSANameState(Operation *op, const OpPrintingFlags &printerFlags,
- DialectInterfaceCollection<OpAsmDialectInterface> &interfaces);
+ SSANameState(Operation *op, const OpPrintingFlags &printerFlags);
/// Print the SSA identifier for the given value to 'stream'. If
/// 'printResultNo' is true, it also presents the result number ('#' number)
@@ -866,15 +865,12 @@ class SSANameState {
/// These are the printing flags. They control, eg., whether to print in
/// generic form.
OpPrintingFlags printerFlags;
-
- DialectInterfaceCollection<OpAsmDialectInterface> &interfaces;
};
} // namespace
SSANameState::SSANameState(
- Operation *op, const OpPrintingFlags &printerFlags,
- DialectInterfaceCollection<OpAsmDialectInterface> &interfaces)
- : printerFlags(printerFlags), interfaces(interfaces) {
+ Operation *op, const OpPrintingFlags &printerFlags)
+ : printerFlags(printerFlags) {
llvm::SaveAndRestore<unsigned> valueIDSaver(nextValueID);
llvm::SaveAndRestore<unsigned> argumentIDSaver(nextArgumentID);
llvm::SaveAndRestore<unsigned> conflictIDSaver(nextConflictID);
@@ -1071,8 +1067,6 @@ void SSANameState::numberValuesInOp(Operation &op) {
if (!printerFlags.shouldPrintGenericOpForm()) {
if (OpAsmOpInterface asmInterface = dyn_cast<OpAsmOpInterface>(&op))
asmInterface.getAsmResultNames(setResultNameFn);
- else if (auto *asmInterface = interfaces.getInterfaceFor(op.getDialect()))
- asmInterface->getAsmResultNames(&op, setResultNameFn);
}
// If the first result wasn't numbered, give it a default number.
@@ -1172,7 +1166,7 @@ class AsmStateImpl {
public:
explicit AsmStateImpl(Operation *op, const OpPrintingFlags &printerFlags,
AsmState::LocationMap *locationMap)
- : interfaces(op->getContext()), nameState(op, printerFlags, interfaces),
+ : interfaces(op->getContext()), nameState(op, printerFlags),
printerFlags(printerFlags), locationMap(locationMap) {}
/// Initialize the alias state to enable the printing of aliases.
diff --git a/mlir/test/IR/parser.mlir b/mlir/test/IR/parser.mlir
index 636f4eea0c5ff..0c7bdd1e08bae 100644
--- a/mlir/test/IR/parser.mlir
+++ b/mlir/test/IR/parser.mlir
@@ -1209,18 +1209,15 @@ func private @string_attr_name() attributes {"0 . 0", nested = {"0 . 0"}}
func private @nested_reference() attributes {test.ref = @some_symbol::@some_nested_symbol }
// CHECK-LABEL: func @custom_asm_names
-func @custom_asm_names() -> (i32, i32, i32, i32, i32, i32, i32) {
+func @custom_asm_names() -> (i32, i32, i32, i32, i32, i32) {
// CHECK: %[[FIRST:first.*]], %[[MIDDLE:middle_results.*]]:2, %[[LAST:[0-9]+]]
%0, %1:2, %2 = "test.asm_interface_op"() : () -> (i32, i32, i32, i32)
// CHECK: %[[FIRST_2:first.*]], %[[LAST_2:[0-9]+]]
%3, %4 = "test.asm_interface_op"() : () -> (i32, i32)
- // CHECK: %[[RESULT:result.*]]
- %5 = "test.asm_dialect_interface_op"() : () -> (i32)
-
// CHECK: return %[[FIRST]], %[[MIDDLE]]#0, %[[MIDDLE]]#1, %[[LAST]], %[[FIRST_2]], %[[LAST_2]]
- return %0, %1#0, %1#1, %2, %3, %4, %5 : i32, i32, i32, i32, i32, i32, i32
+ return %0, %1#0, %1#1, %2, %3, %4 : i32, i32, i32, i32, i32, i32
}
diff --git a/mlir/test/lib/Dialect/Test/TestDialect.cpp b/mlir/test/lib/Dialect/Test/TestDialect.cpp
index 4d316bd58a8ad..2b915a9fd6c2a 100644
--- a/mlir/test/lib/Dialect/Test/TestDialect.cpp
+++ b/mlir/test/lib/Dialect/Test/TestDialect.cpp
@@ -99,12 +99,6 @@ struct TestOpAsmInterface : public OpAsmDialectInterface {
}
return AliasResult::NoAlias;
}
-
- void getAsmResultNames(Operation *op,
- OpAsmSetValueNameFn setNameFn) const final {
- if (auto asmOp = dyn_cast<AsmDialectInterfaceOp>(op))
- setNameFn(asmOp, "result");
- }
};
struct TestDialectFoldInterface : public DialectFoldInterface {
More information about the Mlir-commits
mailing list