public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marek Polacek <polacek@redhat.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix up tm_clone_hasher
Date: Thu, 30 Apr 2015 09:40:00 -0000	[thread overview]
Message-ID: <20150430093004.GF3384@redhat.com> (raw)
In-Reply-To: <20150422152443.GH28950@redhat.com>

Ping.

On Wed, Apr 22, 2015 at 05:24:43PM +0200, Marek Polacek wrote:
> handle_cache_entry in tm_clone_hasher looks wrong: the condition
> if (e != HTAB_EMPTY_ENTRY || e != HTAB_DELETED_ENTRY) is always true.  While
> it could be fixed by just changing || into &&, I decided to follow suit and
> do what we do in handle_cache_entry's elsewhere in the codebase.  I've fixed
> a formatting issue below while at it.
> 
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
> I think this should also go into 5.1.
> 
> 2015-04-22  Marek Polacek  <polacek@redhat.com>
> 
> 	* varasm.c (handle_cache_entry): Fix logic.
> 
> diff --git gcc/varasm.c gcc/varasm.c
> index 1597de1..3fc0316 100644
> --- gcc/varasm.c
> +++ gcc/varasm.c
> @@ -5779,21 +5779,20 @@ struct tm_clone_hasher : ggc_cache_hasher<tree_map *>
>    static hashval_t hash (tree_map *m) { return tree_map_hash (m); }
>    static bool equal (tree_map *a, tree_map *b) { return tree_map_eq (a, b); }
>  
> -  static void handle_cache_entry (tree_map *&e)
> +  static void
> +  handle_cache_entry (tree_map *&e)
>    {
> -    if (e != HTAB_EMPTY_ENTRY || e != HTAB_DELETED_ENTRY)
> -      {
> -	extern void gt_ggc_mx (tree_map *&);
> -	if (ggc_marked_p (e->base.from))
> -	  gt_ggc_mx (e);
> -	else
> -	  e = static_cast<tree_map *> (HTAB_DELETED_ENTRY);
> -      }
> +    extern void gt_ggc_mx (tree_map *&);
> +    if (e == HTAB_EMPTY_ENTRY || e == HTAB_DELETED_ENTRY)
> +      return;
> +    else if (ggc_marked_p (e->base.from))
> +      gt_ggc_mx (e);
> +    else
> +      e = static_cast<tree_map *> (HTAB_DELETED_ENTRY);
>    }
>  };
>  
> -static GTY((cache))
> -     hash_table<tm_clone_hasher> *tm_clone_hash;
> +static GTY((cache)) hash_table<tm_clone_hasher> *tm_clone_hash;
>  
>  void
>  record_tm_clone_pair (tree o, tree n)
> 
> 	Marek

	Marek

  reply	other threads:[~2015-04-30  9:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-22 15:24 Marek Polacek
2015-04-30  9:40 ` Marek Polacek [this message]
2015-04-30 17:21   ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150430093004.GF3384@redhat.com \
    --to=polacek@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).