Skip to content

Commit

Permalink
llvm_ir_generator: handle no-op coercions.
Browse files Browse the repository at this point in the history
whitequark authored and sbourdeauducq committed Nov 21, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 0da2202 commit 372e8f9
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions artiq/compiler/transforms/llvm_ir_generator.py
Original file line number Diff line number Diff line change
@@ -849,6 +849,8 @@ def process_SetElem(self, insn):

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)
4 changes: 4 additions & 0 deletions artiq/test/lit/codegen/noop_coercion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# RUN: %python -m artiq.compiler.testbench.llvmgen %s

def f():
return float(1.0)

0 comments on commit 372e8f9

Please sign in to comment.