[Mlir-commits] [mlir] 62bf850 - [mlir] Flipping Test dialect to prefixed form _Both

Jacques Pienaar llvmlistbot at llvm.org
Mon Oct 18 10:01:11 PDT 2021


Author: Jacques Pienaar
Date: 2021-10-18T10:00:37-07:00
New Revision: 62bf850910e66cef223fb36c6cedb7a90f6aee3c

URL: https://github.com/llvm/llvm-project/commit/62bf850910e66cef223fb36c6cedb7a90f6aee3c
DIFF: https://github.com/llvm/llvm-project/commit/62bf850910e66cef223fb36c6cedb7a90f6aee3c.diff

LOG: [mlir] Flipping Test dialect to prefixed form _Both

Starting with a mostly NFC change to be able to differentiate between
mechanical changes from ones that require more detailed review.

This will be used to flush out flow before flipping dialects used
outside local testing. As this dialect is not intended to be used
generally rather than in tests in core, I will not be following 2 week
staging approach here.

Added: 
    

Modified: 
    mlir/test/lib/Dialect/Test/TestDialect.cpp
    mlir/test/lib/Dialect/Test/TestOps.td

Removed: 
    


################################################################################
diff  --git a/mlir/test/lib/Dialect/Test/TestDialect.cpp b/mlir/test/lib/Dialect/Test/TestDialect.cpp
index b846f89145b4..6040823239bf 100644
--- a/mlir/test/lib/Dialect/Test/TestDialect.cpp
+++ b/mlir/test/lib/Dialect/Test/TestDialect.cpp
@@ -771,7 +771,7 @@ OpFoldResult TestOpConstant::fold(ArrayRef<Attribute> operands) {
 
 LogicalResult TestOpWithVariadicResultsAndFolder::fold(
     ArrayRef<Attribute> operands, SmallVectorImpl<OpFoldResult> &results) {
-  for (Value input : this->operands()) {
+  for (Value input : this->getOperands()) {
     results.push_back(input);
   }
   return success();

diff  --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td
index b64083b1d619..e7144ccf29f6 100644
--- a/mlir/test/lib/Dialect/Test/TestOps.td
+++ b/mlir/test/lib/Dialect/Test/TestOps.td
@@ -26,6 +26,9 @@ include "TestInterfaces.td"
 def Test_Dialect : Dialect {
   let name = "test";
   let cppNamespace = "::test";
+  // Temporarily flipping to _Both (given this is test only/not intended for
+  // general use, this won't be following the 2 week process here).
+  let emitAccessorPrefix = kEmitAccessorPrefix_Both;
   let hasCanonicalizer = 1;
   let hasConstantMaterializer = 1;
   let hasOperationAttrVerify = 1;
@@ -160,7 +163,7 @@ def MixedNormalVariadicOperandOp : TEST_Op<
 def VariadicWithSameOperandsResult :
       TEST_Op<"variadic_with_same_operand_results",
               [SameOperandsAndResultType]> {
-  let arguments = (ins Variadic<AnySignlessInteger>:$operands);
+  let arguments = (ins Variadic<AnySignlessInteger>);
   let results = (outs AnySignlessInteger:$result);
 }
 
@@ -961,9 +964,6 @@ def TestOpWithRegionPattern : TEST_Op<"op_with_region_pattern"> {
 def TestOpConstant : TEST_Op<"constant", [ConstantLike, NoSideEffect]> {
   let arguments = (ins AnyAttr:$value);
   let results = (outs AnyType);
-  let extraClassDeclaration = [{
-    ::mlir::Attribute getValue() { return (*this)->getAttr("value"); }
-  }];
 
   let hasFolder = 1;
 }
@@ -989,7 +989,7 @@ def TestOpWithRegionFold : TEST_Op<"op_with_region_fold"> {
 }
 
 def TestOpWithVariadicResultsAndFolder: TEST_Op<"op_with_variadic_results_and_folder"> {
-  let arguments = (ins Variadic<I32>:$operands);
+  let arguments = (ins Variadic<I32>);
   let results = (outs Variadic<I32>);
   let hasFolder = 1;
 }
@@ -1835,9 +1835,9 @@ def FormatTwoVariadicOperandsNoBuildableTypeOp
 def FormatInferVariadicTypeFromNonVariadic
     : TEST_Op<"format_infer_variadic_type_from_non_variadic",
               [SameOperandsAndResultType]> {
-  let arguments = (ins Variadic<AnyType>:$operands);
+  let arguments = (ins Variadic<AnyType>:$args);
   let results = (outs AnyType:$result);
-  let assemblyFormat = "$operands attr-dict `:` type($result)";
+  let assemblyFormat = "$args attr-dict `:` type($result)";
 }
 
 def FormatOptionalUnitAttr : TEST_Op<"format_optional_unit_attribute"> {
@@ -2067,10 +2067,6 @@ def CopyOp : TEST_Op<"copy", [CopyOpInterface]> {
     `(` $source `,` $target `)` `:` `(` type($source) `,` type($target) `)`
      attr-dict
   }];
-  let extraClassDeclaration = [{
-    ::mlir::Value getSource() { return source(); }
-    ::mlir::Value getTarget() { return target(); }
-  }];
 }
 
 //===----------------------------------------------------------------------===//


        


More information about the Mlir-commits mailing list