Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4305903ddecc
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f68e4ae5194b
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Dec 5, 2016

  1. Revert "compiler: rein in overzealous cast monomorphization."

    This reverts commit 4305903.
    
    This broke the monomorphizer/round.py test.
    whitequark committed Dec 5, 2016
    Copy the full SHA
    218720c View commit details
  2. compiler: rein in overzealous cast monomorphization.

    whitequark committed Dec 5, 2016
    Copy the full SHA
    f68e4ae View commit details
Showing with 11 additions and 5 deletions.
  1. +11 −5 artiq/compiler/transforms/cast_monomorphizer.py
16 changes: 11 additions & 5 deletions artiq/compiler/transforms/cast_monomorphizer.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
"""

from pythonparser import algorithm, diagnostic
from .. import types, builtins
from .. import types, builtins, asttyped

class CastMonomorphizer(algorithm.Visitor):
def __init__(self, engine):
@@ -13,13 +13,19 @@ def __init__(self, engine):
def visit_CallT(self, node):
self.generic_visit(node)

if ((types.is_builtin(node.func.type, "int") or
types.is_builtin(node.func.type, "int32") or
types.is_builtin(node.func.type, "int64")) and
types.is_var(node.type)):
if (types.is_builtin(node.func.type, "int") or
types.is_builtin(node.func.type, "int32") or
types.is_builtin(node.func.type, "int64")):
typ = node.type.find()
if (not types.is_var(typ["width"]) and
builtins.is_int(node.args[0].type) and
types.is_var(node.args[0].type.find()["width"])):
if isinstance(node.args[0], asttyped.BinOpT):
# Binary operations are a bit special: they can widen, and so their
# return type is indeterminate until both argument types are fully known.
# In case we first monomorphize the return type, and then some argument type,
# and argument type is wider than return type, we'll introduce a conflict.
return

node.args[0].type.unify(typ)