aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKamil Dudka <kdudka@redhat.com>2011-08-28 01:29:13 +0200
committerChristopher Li <sparse@chrisli.org>2011-08-27 23:29:26 -0700
commitd385c9d0de358531abca1ac0685a7e1f462d69e2 (patch)
tree6f7f90272075d54d72b7a142618672646aaa04f0
parent31dc25301b584f8d938629f9a68c5db83ec6241b (diff)
downloadsparse-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.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/cse.c b/cse.c
index 2aabb657..e8fbe344 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;