Skip to content

Commit

Permalink
Calculate block def site of variables once
Browse files Browse the repository at this point in the history
  • Loading branch information
rihi committed Jul 31, 2024
1 parent 3ed0094 commit 53531b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions decompiler/pipeline/preprocessing/phi_predecessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def run(self, task: DecompilerTask):
self.cfg = task.graph
self.head = task.graph.root
self._def_map, self._use_map = _init_maps(self.cfg)
self._basic_block_of_definition = _init_basicblocks_of_definition(self.cfg)
self.extend_phi_functions()

def extend_phi_functions(self):
Expand Down Expand Up @@ -77,10 +78,9 @@ def _basicblocks_of_used_variables_in_phi_function(
each key is the variable that is defined at the node
"""
variable_definition_nodes: Dict[BasicBlock, Variable] = dict()
basic_block_of_definition = _init_basicblocks_of_definition(self.cfg)
for variable in used_variables:
if self._def_map.get(variable):
node_with_variable_definition = basic_block_of_definition[variable]
node_with_variable_definition = self._basic_block_of_definition[variable]
else:
node_with_variable_definition = None if is_head else self.head
if node_with_variable_definition not in variable_definition_nodes.keys():
Expand Down

0 comments on commit 53531b2

Please sign in to comment.