Skip to content

Commit 372e8f9

Browse files
whitequarksbourdeauducq
whitequark
authored andcommittedNov 21, 2016
llvm_ir_generator: handle no-op coercions.
1 parent 0da2202 commit 372e8f9

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed
 

‎artiq/compiler/transforms/llvm_ir_generator.py

+2
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,8 @@ def process_SetElem(self, insn):
849849

850850
def process_Coerce(self, insn):
851851
typ, value_typ = insn.type, insn.value().type
852+
if typ == value_typ:
853+
return self.map(insn.value())
852854
if builtins.is_int(typ) and builtins.is_float(value_typ):
853855
return self.llbuilder.fptosi(self.map(insn.value()), self.llty_of_type(typ),
854856
name=insn.name)
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# RUN: %python -m artiq.compiler.testbench.llvmgen %s
2+
3+
def f():
4+
return float(1.0)

0 commit comments

Comments
 (0)