This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Update SSA_NAME manager to use two lists
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 30 Sep 2015 20:46:07 +0200
- Subject: Re: [PATCH] Update SSA_NAME manager to use two lists
- Authentication-results: sourceware.org; auth=none
- References: <560C1F86 dot 5040507 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Sep 30, 2015 at 11:44:38AM -0600, Jeff Law wrote:
> +/* Move all SSA_NAMEs from FREE_SSA_NAMES_QUEUE to FREE_SSA_NAMES.
> +
> + We do not, but should have a mode to verify the state of the SSA_NAMEs
> + lists. In particular at this point every name must be in the IL,
> + on the free list or in the queue. Anything else is an error. */
> +
> +void
> +flush_ssaname_freelist (void)
> +{
> + while (!vec_safe_is_empty (FREE_SSANAMES_QUEUE (cfun)))
> + {
> + tree t = FREE_SSANAMES_QUEUE (cfun)->pop ();
> + vec_safe_push (FREE_SSANAMES (cfun), t);
> + }
Isn't it faster to just do:
vec_safe_splice (FREE_SSANAMES (cfun), FREE_SSANAMES_QUEUE (cfun));
vec_safe_truncate (FREE_SSANAMES_QUEUE (cfun));
or so? I mean, rather than reallocating the vector perhaps many times
grow it just once to the exact size, and memcpy there the data.
Jakub