diff options
author | Kamil Dudka <kdudka@redhat.com> | 2011-08-28 01:29:13 +0200 |
---|---|---|
committer | Christopher Li <sparse@chrisli.org> | 2011-08-27 23:29:26 -0700 |
commit | d385c9d0de358531abca1ac0685a7e1f462d69e2 (patch) | |
tree | 6f7f90272075d54d72b7a142618672646aaa04f0 | |
parent | 31dc25301b584f8d938629f9a68c5db83ec6241b (diff) | |
download | sparse-d385c9d0de358531abca1ac0685a7e1f462d69e2.tar.gz |
cse: update PHI users when throwing away an instruction
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
Signed-off-by: Christopher Li <sparse@chrisli.org>
-rw-r--r-- | cse.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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; |