Index: mlir/test/lib/Dialect/Test/TestOps.td =================================================================== --- mlir/test/lib/Dialect/Test/TestOps.td +++ mlir/test/lib/Dialect/Test/TestOps.td @@ -1270,6 +1270,16 @@ (`[` $variadic^ `]`)? attr-dict }]>; +def FormatTwoVariadicOperandsNoBuildableTypeOp + : TEST_Op<"format_two_variadic_operands_no_buildable_type_op", + [AttrSizedOperandSegments]> { + let arguments = (ins Variadic:$a, + Variadic:$b); + let assemblyFormat = [{ + `(` $a `:` type($a) `)` `->` `(` $b `:` type($b) `)` attr-dict + }]; +} + //===----------------------------------------------------------------------===// // Test SideEffects //===----------------------------------------------------------------------===// Index: mlir/tools/mlir-tblgen/OpFormatGen.cpp =================================================================== --- mlir/tools/mlir-tblgen/OpFormatGen.cpp +++ mlir/tools/mlir-tblgen/OpFormatGen.cpp @@ -741,10 +741,8 @@ // Initialize the set of buildable types. if (!buildableTypes.empty()) { - body << " Builder &builder = parser.getBuilder();\n"; - FmtContext typeBuilderCtx; - typeBuilderCtx.withBuilder("builder"); + typeBuilderCtx.withBuilder("parser.getBuilder()"); for (auto &it : buildableTypes) body << " Type odsBuildableType" << it.second << " = " << tgfmt(it.first, &typeBuilderCtx) << ";\n"; @@ -867,7 +865,7 @@ OpMethodBody &body) { if (!allOperands && op.getTrait("OpTrait::AttrSizedOperandSegments")) { body << " result.addAttribute(\"operand_segment_sizes\", " - << "builder.getI32VectorAttr({"; + << "parser.getBuilder().getI32VectorAttr({"; auto interleaveFn = [&](const NamedTypeConstraint &operand) { // If the operand is variadic emit the parsed size. if (operand.isVariableLength())