aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-11-25 17:56:50 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:04:54 -0700
commit9eb3f1e8a155b769af96005dadc282b3cf401fba (patch)
tree4943f75a9b044ce1f1caf588e6c205388d3ad3bc /simplify.c
parentUse cleaned-up ptr list removal for removing basic blocks (diff)
downloadsparse-9eb3f1e8a155b769af96005dadc282b3cf401fba.tar.gz
sparse-9eb3f1e8a155b769af96005dadc282b3cf401fba.tar.bz2
sparse-9eb3f1e8a155b769af96005dadc282b3cf401fba.zip
Be more thorough about killing unreachable instructions.
We want to make sure that we kill them properly, so that any pseudos they depended on or generated are also killed.
Diffstat (limited to 'simplify.c')
-rw-r--r--simplify.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/simplify.c b/simplify.c
index d28a795..534e8d4 100644
--- a/simplify.c
+++ b/simplify.c
@@ -143,21 +143,21 @@ static int clean_up_phi(struct instruction *insn)
return if_convert_phi(insn);
}
-static void try_to_kill(struct instruction *);
-
static void kill_use(pseudo_t pseudo)
{
if (pseudo->type == PSEUDO_REG) {
if (ptr_list_size((struct ptr_list *)pseudo->users) == 1) {
- try_to_kill(pseudo->def);
+ kill_instruction(pseudo->def);
}
}
}
-static void try_to_kill(struct instruction *insn)
+void kill_instruction(struct instruction *insn)
{
- int opcode = insn->opcode;
- switch (opcode) {
+ if (!insn->bb)
+ return;
+
+ switch (insn->opcode) {
case OP_BINARY ... OP_BINCMP_END:
insn->bb = NULL;
kill_use(insn->src1);