[Mlir-commits] [mlir] [MLIR][Python] Add optional `results` parameter for building op with inferable result types (PR #156818)
Maksim Levental
llvmlistbot at llvm.org
Thu Sep 4 09:27:55 PDT 2025
================
@@ -226,21 +226,21 @@ def DefaultValuedAttrsOp : TestOp<"default_valued_attrs"> {
// CHECK-LABEL: OPERATION_NAME = "test.derive_result_types_op"
def DeriveResultTypesOp : TestOp<"derive_result_types_op", [FirstAttrDerivedResultType]> {
- // CHECK: def __init__(self, type_, *, loc=None, ip=None):
+ // CHECK: def __init__(self, type_, *, results=None, loc=None, ip=None):
// CHECK: operands = []
- // CHECK: results = []
- // CHECK: _ods_result_type_source_attr = attributes["type"]
- // CHECK: _ods_derived_result_type = (
+ // CHECK: if results is None:
+ // CHECK: _ods_result_type_source_attr = attributes["type"]
+ // CHECK: _ods_derived_result_type = (
// CHECK: _ods_ir.TypeAttr(_ods_result_type_source_attr).value
// CHECK: if _ods_ir.TypeAttr.isinstance(_ods_result_type_source_attr) else
// CHECK: _ods_result_type_source_attr.type)
- // CHECK: results.extend([_ods_derived_result_type] * 2)
+ // CHECK: results = [_ods_derived_result_type] * 2
----------------
makslevental wrote:
I believe this needs to be indented two spaces (otherwise you're always overwriting `results`)
https://github.com/llvm/llvm-project/pull/156818
More information about the Mlir-commits
mailing list