Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed the definition bug in other peephole
  • Loading branch information
njriasan committed May 12, 2022
commit 162020645c040c6b1e802d052635f868f04bad69
41 changes: 7 additions & 34 deletions numba/core/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,6 @@ def _remove_assignment_definition(old_body, idx, func_ir):
rhs = old_body[idx].value
if rhs in func_ir._definitions[lhs]:
func_ir._definitions[lhs].remove(rhs)
elif len(func_ir._definitions[lhs]) == 1:
# There appears to be an issue where the RHS of the
# definitions doesn't match after the list -> tuple
# conversion.
# For example the statement is:
#
# 172list_to_tuple.116 = $170list_append.115
#
# but the definition is:
#
# list_to_tuple(info=('$4build_list.1',))
#
func_ir._definitions[lhs].clear()
else:
raise UnsupportedError(
"Inconsistency found in the definitions while executing"
Expand Down Expand Up @@ -684,28 +671,14 @@ def peep_hole_call_function_ex_to_call_function_kw(func_ir):
# if the list -> tuple conversion failed and if so
# throw an error.
call = stmt.value
args = call.args
vararg = call.vararg
if args:
# If we have vararg then args is expected to
# be an empty list.
raise UnsupportedError(errmsg)
vararg_loc = i - 1
args_def = None
found = False
while vararg_loc >= 0 and not found:
args_def = blk.body[vararg_loc]
if (
isinstance(args_def, ir.Assign)
and args_def.target.name == vararg.name
):
found = True
else:
vararg_loc -= 1
if found:
vararg_name = call.vararg.name
if (
vararg_name in func_ir._definitions
and len(func_ir._definitions[vararg_name]) == 1
):
# If this value is still a list to tuple raise the
# exception.
expr = blk.body[vararg_loc].value
expr = func_ir._definitions[vararg_name][0]
if isinstance(expr, ir.Expr) and expr.op == "list_to_tuple":
raise UnsupportedError(errmsg)

Expand Down Expand Up @@ -893,7 +866,7 @@ def append_and_fix(x):
new_hole.append(x)
# Finally write the result back into the original build list as
# everything refers to it.
new_hole.append(ir.Assign(acc, t2l_agn.target,
append_and_fix(ir.Assign(acc, t2l_agn.target,
the_build_list.loc))
if _DEBUG:
print("\nNEW HOLE:")
Expand Down