Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit 7575288

Browse files
author
Ehsan Totoni
committed
update definitions after hiframes pass
1 parent 65aaf91 commit 7575288

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

hpat/hiframes.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import print_function, division, absolute_import
22
import types as pytypes # avoid confusion with numba.types
3-
3+
import collections
44
import numba
55
from numba import ir, config, ir_utils, types
66
from numba import compiler as numba_compiler
@@ -78,6 +78,7 @@ def run(self):
7878
self.typemap, self.return_type, self.calltypes = numba_compiler.type_inference_stage(
7979
self.typingctx, self.func_ir, self.args, None)
8080
self.fix_series_filter(self.func_ir.blocks)
81+
self.func_ir._definitions = _get_definitions(self.func_ir.blocks)
8182
dprint_func_ir(self.func_ir, "after hiframes")
8283
if config.DEBUG_ARRAY_OPT==1:
8384
print("df_vars: ", self.df_vars)
@@ -535,3 +536,11 @@ def include_new_blocks(blocks, new_blocks, label, new_body):
535536
inner_blocks[inner_last_label].body.append(ir.Jump(label, loc))
536537
#new_body.clear()
537538
return label
539+
540+
def _get_definitions(blocks):
541+
definitions = collections.defaultdict(list)
542+
for block in blocks.values():
543+
for inst in block.body:
544+
if isinstance(inst, ir.Assign):
545+
definitions[inst.target.name].append(inst.value)
546+
return definitions

0 commit comments

Comments
 (0)