diff mbox

[05/16] fix clear_phi(), replace it by kill_instruction()

Message ID 20170216045708.50661-6-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show

Commit Message

Luc Van Oostenryck Feb. 16, 2017, 4:56 a.m. UTC
clear_phi() only replaces a phi-node's sources by VOID
without adjusting the usage of these sources.
As such it can't be used for cleaning things before
removing an OP_PHI.

Fix this by replacing calls to clear_phi() by calls
to kill_instruction().

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 simplify.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/simplify.c b/simplify.c
index 17f1e2b61..ddd0aa9c5 100644
--- a/simplify.c
+++ b/simplify.c
@@ -110,7 +110,7 @@  static int if_convert_phi(struct instruction *insn)
 	 * the conditional branch too.
 	 */
 	insert_select(source, br, insn, p1, p2);
-	clear_phi(insn);
+	kill_instruction(insn);
 	return REPEAT_CSE;
 }
 
@@ -140,7 +140,7 @@  static int clean_up_phi(struct instruction *insn)
 	if (same) {
 		pseudo_t pseudo = last ? last->src1 : VOID;
 		convert_instruction_target(insn, pseudo);
-		clear_phi(insn);
+		kill_instruction(insn);
 		return REPEAT_CSE;
 	}
 
@@ -1142,7 +1142,7 @@  int simplify_instruction(struct instruction *insn)
 		return simplify_cast(insn);
 	case OP_PHI:
 		if (dead_insn(insn, NULL, NULL, NULL)) {
-			clear_phi(insn);
+			kill_use_list(insn->phi_list);
 			return REPEAT_CSE;
 		}
 		return clean_up_phi(insn);