mirror of https://github.com/llvm/torch-mlir
Add None constants.
parent
4cd604f2a2
commit
7c176ed872
|
@ -76,3 +76,11 @@ def ellipsis():
|
||||||
# CHECK: basicpy.unknown_cast %[[A]]
|
# CHECK: basicpy.unknown_cast %[[A]]
|
||||||
a = ...
|
a = ...
|
||||||
return a
|
return a
|
||||||
|
|
||||||
|
# CHECK-LABEL: func @none_constant
|
||||||
|
@import_global
|
||||||
|
def none_constant():
|
||||||
|
# CHECK: %[[A:.*]] = basicpy.singleton : !basicpy.NoneType
|
||||||
|
# CHECK: basicpy.unknown_cast %[[A]]
|
||||||
|
a = None
|
||||||
|
return a
|
||||||
|
|
|
@ -191,6 +191,8 @@ class ExpressionImporter(BaseNodeVisitor):
|
||||||
self.value = ir_h.basicpy_bool_constant_op(True).result
|
self.value = ir_h.basicpy_bool_constant_op(True).result
|
||||||
elif value is False:
|
elif value is False:
|
||||||
self.value = ir_h.basicpy_bool_constant_op(False).result
|
self.value = ir_h.basicpy_bool_constant_op(False).result
|
||||||
|
elif value is None:
|
||||||
|
self.value = ir_h.basicpy_singleton_op(ir_h.basicpy_NoneType).result
|
||||||
elif isinstance(value, int):
|
elif isinstance(value, int):
|
||||||
# TODO: Configurable type mapping
|
# TODO: Configurable type mapping
|
||||||
ir_type = ir_h.i64_type
|
ir_type = ir_h.i64_type
|
||||||
|
|
Loading…
Reference in New Issue