mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-26 11:48:27 +08:00
llvm_ir_generator: handle no-op coercions.
This commit is contained in:
parent
0da2202179
commit
372e8f9b2b
@ -849,6 +849,8 @@ class LLVMIRGenerator:
|
|||||||
|
|
||||||
def process_Coerce(self, insn):
|
def process_Coerce(self, insn):
|
||||||
typ, value_typ = insn.type, insn.value().type
|
typ, value_typ = insn.type, insn.value().type
|
||||||
|
if typ == value_typ:
|
||||||
|
return self.map(insn.value())
|
||||||
if builtins.is_int(typ) and builtins.is_float(value_typ):
|
if builtins.is_int(typ) and builtins.is_float(value_typ):
|
||||||
return self.llbuilder.fptosi(self.map(insn.value()), self.llty_of_type(typ),
|
return self.llbuilder.fptosi(self.map(insn.value()), self.llty_of_type(typ),
|
||||||
name=insn.name)
|
name=insn.name)
|
||||||
|
4
artiq/test/lit/codegen/noop_coercion.py
Normal file
4
artiq/test/lit/codegen/noop_coercion.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# RUN: %python -m artiq.compiler.testbench.llvmgen %s
|
||||||
|
|
||||||
|
def f():
|
||||||
|
return float(1.0)
|
Loading…
Reference in New Issue
Block a user