Patchwork Remove redundant variable in hash_set

login
register
mail settings
Submitter Marek Polacek
Date Nov. 26, 2012, 12:09 p.m.
Message ID <20121126120925.GG17362@redhat.com>
Download mbox | patch
Permalink /patch/201661/
State New
Headers show

Comments

Marek Polacek - Nov. 26, 2012, 12:09 p.m.
I don't see why we need the `hash' variable, when we can use the
`regno' variable directly.  Regtested/bootstrapped on x86_64-linux.
Ok for trunk?

2012-11-26  Marek Polacek  <polacek@redhat.com>

	* cprop.c (hash_set): Remove hash variable.  Use regno
	variable directly.


	Marek
Richard Guenther - Nov. 26, 2012, 2:18 p.m.
On Mon, Nov 26, 2012 at 1:09 PM, Marek Polacek <polacek@redhat.com> wrote:
> I don't see why we need the `hash' variable, when we can use the
> `regno' variable directly.  Regtested/bootstrapped on x86_64-linux.
> Ok for trunk?

Ok.

Thanks,
Richard.

> 2012-11-26  Marek Polacek  <polacek@redhat.com>
>
>         * cprop.c (hash_set): Remove hash variable.  Use regno
>         variable directly.
>
> --- gcc/cprop.c.mp      2012-11-26 12:13:08.631193625 +0100
> +++ gcc/cprop.c 2012-11-26 12:13:25.836238566 +0100
> @@ -170,10 +170,7 @@ reg_available_p (const_rtx x, const_rtx
>  static unsigned int
>  hash_set (int regno, int hash_table_size)
>  {
> -  unsigned int hash;
> -
> -  hash = regno;
> -  return hash % hash_table_size;
> +  return (unsigned) regno % hash_table_size;
>  }
>
>  /* Insert assignment DEST:=SET from INSN in the hash table.
>
>         Marek

Patch

--- gcc/cprop.c.mp	2012-11-26 12:13:08.631193625 +0100
+++ gcc/cprop.c	2012-11-26 12:13:25.836238566 +0100
@@ -170,10 +170,7 @@  reg_available_p (const_rtx x, const_rtx
 static unsigned int
 hash_set (int regno, int hash_table_size)
 {
-  unsigned int hash;
-
-  hash = regno;
-  return hash % hash_table_size;
+  return (unsigned) regno % hash_table_size;
 }
 
 /* Insert assignment DEST:=SET from INSN in the hash table.