public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Richard Sandiford <richard.sandiford@arm.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix PR85574
Date: Thu, 03 Jan 2019 14:16:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.20.1901031515330.23386@zhemvz.fhfr.qr> (raw)
In-Reply-To: <87y381rgkk.fsf@arm.com>

On Thu, 3 Jan 2019, Richard Sandiford wrote:

> Richard Biener <rguenther@suse.de> writes:
> > The following rectifies a change during hash-map intruction which
> > changed the uncprop operand_equal_p based hash to a pointer-based
> > hash_map.  That assumes pointer equality between constants which
> > does not hold since different (but compatible) typed constants
> > can appear in the IL.  For SSA names the equivalence holds, of course.
> >
> > Fixing this should increase the number of eliminated const-copies
> > on edges during out-of-SSA.  It also happens to fix the LTO
> > bootstrap miscompare of cc1 and friends, but I can't really
> > explain that.
> >
> > [LTO] bootstrapped and tested on x86_64-unknown-linux-gnu, applied
> > to trunk.
> >
> > Richard.
> >
> > 2019-01-03  Jan Hubicka  <hubicka@ucw.cz>
> >
> > 	PR tree-optimization/85574
> > 	* tree-ssa-uncprop.c (struct equiv_hash_elt): Remove unused
> > 	structure.
> > 	(struct ssa_equip_hash_traits): Declare.
> > 	(val_ssa_equiv): Use custom hash traits using operand_equal_p.
> >
> > Index: gcc/tree-ssa-uncprop.c
> > ===================================================================
> > --- gcc/tree-ssa-uncprop.c	(revision 267549)
> > +++ gcc/tree-ssa-uncprop.c	(working copy)
> > @@ -268,21 +268,24 @@ associate_equivalences_with_edges (void)
> >     so with each value we have a list of SSA_NAMEs that have the
> >     same value.  */
> >  
> > -
> > -/* Main structure for recording equivalences into our hash table.  */
> > -struct equiv_hash_elt
> > -{
> > -  /* The value/key of this entry.  */
> > -  tree value;
> > -
> > -  /* List of SSA_NAMEs which have the same value/key.  */
> > -  vec<tree> equivalences;
> > +/* Traits for the hash_map to record the value to SSA name equivalences
> > +   mapping.  */
> > +struct ssa_equip_hash_traits : default_hash_traits <tree>
> > +{
> > +  static inline hashval_t hash (value_type value)
> > +    { return iterative_hash_expr (value, 0); }
> > +  static inline bool equal (value_type existing, value_type candidate)
> > +    { return operand_equal_p (existing, candidate, 0); }
> >  };
> 
> FWIW, this is a dup of tree_operand_hash.

Indeed.  Testing patch to do the obvious replacement.

Richard.

> Thanks,
> Richard
> 
> > +typedef hash_map<tree, auto_vec<tree>,
> > +		 simple_hashmap_traits <ssa_equip_hash_traits,
> > +					auto_vec <tree> > > val_ssa_equiv_t;
> > +
> >  /* Global hash table implementing a mapping from invariant values
> >     to a list of SSA_NAMEs which have the same value.  We might be
> >     able to reuse tree-vn for this code.  */
> > -static hash_map<tree, auto_vec<tree> > *val_ssa_equiv;
> > +val_ssa_equiv_t *val_ssa_equiv;
> >  
> >  static void uncprop_into_successor_phis (basic_block);
> >  
> > @@ -476,7 +479,7 @@ pass_uncprop::execute (function *fun)
> >    associate_equivalences_with_edges ();
> >  
> >    /* Create our global data structures.  */
> > -  val_ssa_equiv = new hash_map<tree, auto_vec<tree> > (1024);
> > +  val_ssa_equiv = new val_ssa_equiv_t (1024);
> >  
> >    /* We're going to do a dominator walk, so ensure that we have
> >       dominance information.  */
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)

  reply	other threads:[~2019-01-03 14:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-03 12:20 Richard Biener
2019-01-03 13:55 ` Richard Sandiford
2019-01-03 14:16   ` Richard Biener [this message]
2019-01-07 14:32     ` Richard Biener
  -- strict thread matches above, loose matches on Subject: below --
2018-05-04  7:24 Richard Biener

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=alpine.LSU.2.20.1901031515330.23386@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.sandiford@arm.com \
    /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).