diff mbox series

reduce sparseset memory requirement

Message ID nycvar.YFH.7.76.2102091203460.29119@elmra.sevgm.obk
State New
Headers show
Series reduce sparseset memory requirement | expand

Commit Message

Richard Biener Feb. 9, 2021, 11:05 a.m. UTC
Currently we use HOST_WIDEST_FAST_INT for the sparseset element
type which maps to a 64bit type on 64bit hosts.  That's excessive
for the only current sparseset users which are LRA and IRA and
which store register numbers in it which are unsigned int.  The
following changes the sparseset element type to unsigned int.

This was changed (in accident?) in 0263463dd114 and the following
just reverts that bit.

Bootstrap / regtest pending on x86_64-unknown-linux-gnu, OK?

Thanks,
Richard.

2021-02-09  Richard Biener  <rguenther@suse.de>

	* sparseset.h (SPARSESET_ELT_BITS): Remove.
	(SPARSESET_ELT_TYPE): Use unsigned int.
	* fwprop.c: Do not include sparseset.h.
---
 gcc/fwprop.c    | 1 -
 gcc/sparseset.h | 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

Comments

Richard Biener Feb. 11, 2021, 11:46 a.m. UTC | #1
On Tue, Feb 9, 2021 at 12:38 PM Richard Biener <rguenther@suse.de> wrote:
>
> Currently we use HOST_WIDEST_FAST_INT for the sparseset element
> type which maps to a 64bit type on 64bit hosts.  That's excessive
> for the only current sparseset users which are LRA and IRA and
> which store register numbers in it which are unsigned int.  The
> following changes the sparseset element type to unsigned int.
>
> This was changed (in accident?) in 0263463dd114 and the following
> just reverts that bit.
>
> Bootstrap / regtest pending on x86_64-unknown-linux-gnu, OK?

I've now verified that all callers of sparseset_alloc call it with
an int or unsigned int argument and thus I've pushed the change.

Richard.

> Thanks,
> Richard.
>
> 2021-02-09  Richard Biener  <rguenther@suse.de>
>
>         * sparseset.h (SPARSESET_ELT_BITS): Remove.
>         (SPARSESET_ELT_TYPE): Use unsigned int.
>         * fwprop.c: Do not include sparseset.h.
> ---
>  gcc/fwprop.c    | 1 -
>  gcc/sparseset.h | 3 +--
>  2 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/gcc/fwprop.c b/gcc/fwprop.c
> index 123cc228630..4b8a554e823 100644
> --- a/gcc/fwprop.c
> +++ b/gcc/fwprop.c
> @@ -28,7 +28,6 @@ along with GCC; see the file COPYING3.  If not see
>  #include "df.h"
>  #include "rtl-ssa.h"
>
> -#include "sparseset.h"
>  #include "predict.h"
>  #include "cfgrtl.h"
>  #include "cfgcleanup.h"
> diff --git a/gcc/sparseset.h b/gcc/sparseset.h
> index c72b4fe8aed..536d35c51af 100644
> --- a/gcc/sparseset.h
> +++ b/gcc/sparseset.h
> @@ -83,8 +83,7 @@ along with GCC; see the file COPYING3.  If not see
>
>  /* Data Structure used for the SparseSet representation.  */
>
> -#define SPARSESET_ELT_BITS ((unsigned) HOST_BITS_PER_WIDEST_FAST_INT)
> -#define SPARSESET_ELT_TYPE unsigned HOST_WIDEST_FAST_INT
> +#define SPARSESET_ELT_TYPE unsigned int
>
>  typedef struct sparseset_def
>  {
> --
> 2.26.2
diff mbox series

Patch

diff --git a/gcc/fwprop.c b/gcc/fwprop.c
index 123cc228630..4b8a554e823 100644
--- a/gcc/fwprop.c
+++ b/gcc/fwprop.c
@@ -28,7 +28,6 @@  along with GCC; see the file COPYING3.  If not see
 #include "df.h"
 #include "rtl-ssa.h"
 
-#include "sparseset.h"
 #include "predict.h"
 #include "cfgrtl.h"
 #include "cfgcleanup.h"
diff --git a/gcc/sparseset.h b/gcc/sparseset.h
index c72b4fe8aed..536d35c51af 100644
--- a/gcc/sparseset.h
+++ b/gcc/sparseset.h
@@ -83,8 +83,7 @@  along with GCC; see the file COPYING3.  If not see
 
 /* Data Structure used for the SparseSet representation.  */
 
-#define SPARSESET_ELT_BITS ((unsigned) HOST_BITS_PER_WIDEST_FAST_INT)
-#define SPARSESET_ELT_TYPE unsigned HOST_WIDEST_FAST_INT
+#define SPARSESET_ELT_TYPE unsigned int
 
 typedef struct sparseset_def
 {