From 1bfe6dd32cd41f70856c9c98560380fbc61897ea Mon Sep 17 00:00:00 2001 From: rihi <19492038+rihi@users.noreply.github.com> Date: Thu, 8 Feb 2024 11:39:36 +0100 Subject: [PATCH] Make sure replaced instructions are added after phi instructions --- decompiler/pipeline/commons/expressionpropagationcommons.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/decompiler/pipeline/commons/expressionpropagationcommons.py b/decompiler/pipeline/commons/expressionpropagationcommons.py index e7e09ebd7..d3cc40b5c 100644 --- a/decompiler/pipeline/commons/expressionpropagationcommons.py +++ b/decompiler/pipeline/commons/expressionpropagationcommons.py @@ -85,10 +85,8 @@ def _remove_redundant_phis(self, graph: ControlFlowGraph) -> bool: if not all_equal(instruction.value.operands): continue - basic_block.replace_instruction( - instruction, - Assignment(instruction.destination, instruction.value.operands[0]) - ) + basic_block.remove_instruction(index) + basic_block.add_instruction_where_possible(Assignment(instruction.destination, instruction.value.operands[0])) changes |= True return changes