Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

cse: update PHI users when throwing away an instruction

The attached patch solves the dangling PHI nodes and does not seem to break
anything at first glance.  It is probably not the most efficient solution,
but it might at least show where to look for the problem.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
  • Loading branch information...
commit 7ac3e4bd792ca16d1fc3a0b8ba1c2b046dabb555 1 parent 556cb86
Kamil Dudka authored August 28, 2011 penberg committed August 28, 2011

Showing 1 changed file with 13 additions and 0 deletions. Show diff stats Hide diff stats

  1. 13  cse.c
13  cse.c
@@ -250,6 +250,19 @@ static void sort_instruction_list(struct instruction_list **list)
250 250
 static struct instruction * cse_one_instruction(struct instruction *insn, struct instruction *def)
251 251
 {
252 252
 	convert_instruction_target(insn, def->target);
  253
+
  254
+	if (insn->opcode == OP_PHI) {
  255
+		/* Remove the instruction from PHI users */
  256
+		pseudo_t phi;
  257
+		FOR_EACH_PTR(insn->phi_list, phi) {
  258
+			struct pseudo_user *pu;
  259
+			FOR_EACH_PTR(phi->users, pu) {
  260
+				if (pu->insn == insn)
  261
+					DELETE_CURRENT_PTR(pu);
  262
+			} END_FOR_EACH_PTR(pu);
  263
+		} END_FOR_EACH_PTR(phi);
  264
+	}
  265
+
253 266
 	insn->opcode = OP_NOP;
254 267
 	insn->bb = NULL;
255 268
 	repeat_phase |= REPEAT_CSE;

0 notes on commit 7ac3e4b

Please sign in to comment.
Something went wrong with that request. Please try again.