}) : (i32) -> (i32)
return %0 : i32
}
+
+// CHECK-LABEL: func @remove_op_with_variadic_results_and_folder
+// CHECK-SAME: (%[[ARG_0:[a-z0-9]*]]: i32, %[[ARG_1:[a-z0-9]*]]: i32)
+func @remove_op_with_variadic_results_and_folder(%arg0 : i32, %arg1 : i32) -> (i32, i32) {
+ // CHECK-NEXT: return %[[ARG_0]], %[[ARG_1]]
+ %0, %1 = "test.op_with_variadic_results_and_folder"(%arg0, %arg1) : (i32, i32) -> (i32, i32)
+ return %0, %1 : i32, i32
+}
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) {
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)