llvm_ir_generator: handle no-op coercions.

This commit is contained in:
whitequark 2016-11-21 02:25:27 +00:00
parent eb18466820
commit 7af41bd29c
2 changed files with 6 additions and 0 deletions

View File

@ -848,6 +848,8 @@ class LLVMIRGenerator:
def process_Coerce(self, insn):
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):
return self.llbuilder.fptosi(self.map(insn.value()), self.llty_of_type(typ),
name=insn.name)

View File

@ -0,0 +1,4 @@
# RUN: %python -m artiq.compiler.testbench.llvmgen %s
def f():
return float(1.0)