Skip to contentSkip to conversation

remove dead branch usage

RFC PATCH New Christopher Li 1 participant 1 message Dec 28, 2006 Sparse checker

lore
Share & tools
lore

Christopher Li

author maintainer
#0 lore raw

RFC PATCH 2/4 remove dead branch usage

Fix some problem cause by dead branch instruction left in the user chain.

flow.c +1 -0
Index: sparse/flow.c
===================================================================
@@ -195,6 +195,7 @@ try_to_rewrite_target:
 	if (bb_list_size(target->parents) != 1)
 		return retval;
 	insert_branch(target, insn, final);
+	kill_instruction(insn);
 	return 1;
 }
 
simplify.c +5 -0
Index: sparse/simplify.c
===================================================================
@@ -217,6 +217,11 @@ void kill_instruction(struct instruction
 		kill_use(&insn->src2);
 		kill_use(&insn->src3);
 		return;
+	case OP_BR:
+		insn->bb = NULL;
+		repeat_phase |= REPEAT_CSE;
+		if (insn->cond)
+			kill_use(&insn->cond);
 	}
 }