From 75d548d5b14d492432fcac1a6dc29c07f57faaac Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Thu, 16 Feb 2017 05:57:06 +0100 Subject: [PATCH] use kill_instruction() when killing an OP_PHI during CSE cse_one_instruction() contains some code to be executed when an OP_PHI is eliminated. This code is roughly equivalent to what is done in kill_instruction() for OP_PHI but not complete since it doesn't recursively try to kill others instructions which are used only by this OP_PHI. Fix this and avoid duplicated code by replacing this code by a call to kill_instruction(). Signed-off-by: Luc Van Oostenryck Signed-off-by: Christopher Li --- cse.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/cse.c b/cse.c index e8fbe344..165b862a 100644 --- a/cse.c +++ b/cse.c @@ -252,15 +252,7 @@ static struct instruction * cse_one_instruction(struct instruction *insn, struct convert_instruction_target(insn, def->target); if (insn->opcode == OP_PHI) { - /* Remove the instruction from PHI users */ - pseudo_t phi; - FOR_EACH_PTR(insn->phi_list, phi) { - struct pseudo_user *pu; - FOR_EACH_PTR(phi->users, pu) { - if (pu->insn == insn) - DELETE_CURRENT_PTR(pu); - } END_FOR_EACH_PTR(pu); - } END_FOR_EACH_PTR(phi); + kill_instruction(insn); } insn->opcode = OP_NOP; -- 2.11.4.GIT