From 7024fcdfba9fce20569f86e2a279c76cb94cbfd8 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Sun, 28 Aug 2011 01:29:13 +0200 Subject: [PATCH] cse: update PHI users when throwing away an instruction Signed-off-by: Kamil Dudka --- cse.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/cse.c b/cse.c index 2a15745..1b63c0e 100644 --- a/cse.c +++ b/cse.c @@ -250,6 +250,19 @@ static void sort_instruction_list(struct instruction_list **list) static struct instruction * cse_one_instruction(struct instruction *insn, struct instruction *def) { 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); + } + insn->opcode = OP_NOP; insn->bb = NULL; repeat_phase |= REPEAT_CSE; -- 1.7.6