diff options
| author | Parker Schuh <parkers@google.com> | 2019-10-09 20:42:32 -0700 |
|---|---|---|
| committer | A. Unique TensorFlower <gardener@tensorflow.org> | 2019-10-09 20:44:30 -0700 |
| commit | 309b4556d00f531988f34930eedb546512ee619f (patch) | |
| tree | f78e5bcaa8b6cd6c692a4ecf92425b036bd191c0 /mlir/test/lib/TestDialect | |
| parent | f5813ff8e1133be1cea20166230e578281e341c3 (diff) | |
| download | bcm5719-llvm-309b4556d00f531988f34930eedb546512ee619f.tar.gz bcm5719-llvm-309b4556d00f531988f34930eedb546512ee619f.zip | |
Add test for fix to tablegen for custom folders for ops that return a single
variadic result.
Add missing test for single line fix to `void OpEmitter::genFolderDecls()`
entitled "Fold away reduction over 0 dimensions."
PiperOrigin-RevId: 273880337
Diffstat (limited to 'mlir/test/lib/TestDialect')
| -rw-r--r-- | mlir/test/lib/TestDialect/TestDialect.cpp | 8 | ||||
| -rw-r--r-- | mlir/test/lib/TestDialect/TestOps.td | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/mlir/test/lib/TestDialect/TestDialect.cpp b/mlir/test/lib/TestDialect/TestDialect.cpp index 78a75f0a3d9..c8db7967fe0 100644 --- a/mlir/test/lib/TestDialect/TestDialect.cpp +++ b/mlir/test/lib/TestDialect/TestDialect.cpp @@ -235,6 +235,14 @@ OpFoldResult TestOpWithRegionFold::fold(ArrayRef<Attribute> operands) { return operand(); } +LogicalResult TestOpWithVariadicResultsAndFolder::fold( + ArrayRef<Attribute> operands, SmallVectorImpl<OpFoldResult> &results) { + for (Value *input : this->operands()) { + results.push_back(input); + } + return success(); +} + SmallVector<Type, 2> mlir::OpWithInferTypeInterfaceOp::inferReturnTypes( llvm::Optional<Location> location, ArrayRef<Value *> operands, ArrayRef<NamedAttribute> attributes, ArrayRef<Region> regions) { diff --git a/mlir/test/lib/TestDialect/TestOps.td b/mlir/test/lib/TestDialect/TestOps.td index 68bae706f12..1122bea919f 100644 --- a/mlir/test/lib/TestDialect/TestOps.td +++ b/mlir/test/lib/TestDialect/TestOps.td @@ -485,6 +485,12 @@ def TestOpWithRegionFold : TEST_Op<"op_with_region_fold"> { let hasFolder = 1; } +def TestOpWithVariadicResultsAndFolder: TEST_Op<"op_with_variadic_results_and_folder"> { + let arguments = (ins Variadic<I32>:$operands); + let results = (outs Variadic<I32>); + let hasFolder = 1; +} + //===----------------------------------------------------------------------===// // Test Patterns (Symbol Binding) |

