linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4] Update usage chain for dead instruction
@ 2007-01-17  2:37 Christopher Li
  2007-01-17  5:20 ` Josh Triplett
  0 siblings, 1 reply; 2+ messages in thread
From: Christopher Li @ 2007-01-17  2:37 UTC (permalink / raw)
  To: linux-sparse; +Cc: Josh Triplett


This patch address some of the dead instruction
left in the usage chain.

Signed-Off-By: Christopher Li <sparse@chrisli.org>

Index: sparse/flow.c
===================================================================
--- sparse.orig/flow.c	2006-12-21 14:35:18.000000000 -0800
+++ sparse/flow.c	2006-12-21 14:35:55.000000000 -0800
@@ -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;
 }
 
Index: sparse/simplify.c
===================================================================
--- sparse.orig/simplify.c	2006-12-21 14:35:18.000000000 -0800
+++ sparse/simplify.c	2006-12-21 14:35:55.000000000 -0800
@@ -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);
 	}
 }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 4] Update usage chain for dead instruction
  2007-01-17  2:37 [PATCH 4] Update usage chain for dead instruction Christopher Li
@ 2007-01-17  5:20 ` Josh Triplett
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Triplett @ 2007-01-17  5:20 UTC (permalink / raw)
  To: Christopher Li; +Cc: linux-sparse

[-- Attachment #1: Type: text/plain, Size: 700 bytes --]

Christopher Li wrote:
> This patch address some of the dead instruction
> left in the usage chain.

Merged.

One minor style note:

> --- sparse.orig/simplify.c	2006-12-21 14:35:18.000000000 -0800
> +++ sparse/simplify.c	2006-12-21 14:35:55.000000000 -0800
> @@ -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);
>  	}
>  }

Despite redundancy, please include return or break statements in the last case
of a switch, to make modifications less error-prone.

- Josh Triplett


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-01-17  5:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-17  2:37 [PATCH 4] Update usage chain for dead instruction Christopher Li
2007-01-17  5:20 ` Josh Triplett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).