diff mbox

Remove redundant variable in hash_set

Message ID 20121126120925.GG17362@redhat.com
State New
Headers show

Commit Message

Marek Polacek Nov. 26, 2012, 12:09 p.m. UTC
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

Comments

Richard Biener Nov. 26, 2012, 2:18 p.m. UTC | #1
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
diff mbox

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.