mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-28 20:53:35 +08:00
transforms.llvm_ir_generator: ignore assignments of None (fixes #309).
This commit is contained in:
parent
c7d48a1765
commit
7e16da4a77
@ -655,8 +655,11 @@ class LLVMIRGenerator:
|
||||
|
||||
def process_SetLocal(self, insn):
|
||||
env = insn.environment()
|
||||
llptr = self.llptr_to_var(self.map(env), env.type, insn.var_name)
|
||||
llvalue = self.map(insn.value())
|
||||
if isinstance(llvalue.type, ll.VoidType):
|
||||
# We store NoneType as {} but return it as void. So, bail out here.
|
||||
return ll.Constant(ll.LiteralStructType([]), [])
|
||||
llptr = self.llptr_to_var(self.map(env), env.type, insn.var_name)
|
||||
if isinstance(llvalue, ll.Block):
|
||||
llvalue = ll.BlockAddress(self.llfunction, llvalue)
|
||||
if llptr.type.pointee != llvalue.type:
|
||||
|
6
artiq/test/lit/codegen/assign_none.py
Normal file
6
artiq/test/lit/codegen/assign_none.py
Normal file
@ -0,0 +1,6 @@
|
||||
# RUN: %python -m artiq.compiler.testbench.llvmgen %s
|
||||
|
||||
def f():
|
||||
pass
|
||||
def g():
|
||||
a = f()
|
Loading…
Reference in New Issue
Block a user