From 53531b2a99d077a8495bf34f9b8f151bc6f5dd82 Mon Sep 17 00:00:00 2001 From: rihi <19492038+rihi@users.noreply.github.com> Date: Wed, 31 Jul 2024 19:10:08 +0200 Subject: [PATCH] Calculate block def site of variables once --- decompiler/pipeline/preprocessing/phi_predecessors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/decompiler/pipeline/preprocessing/phi_predecessors.py b/decompiler/pipeline/preprocessing/phi_predecessors.py index b924efdc1..1e617d14d 100644 --- a/decompiler/pipeline/preprocessing/phi_predecessors.py +++ b/decompiler/pipeline/preprocessing/phi_predecessors.py @@ -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): @@ -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():