public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: "Kewen.Lin" <linkw@linux.ibm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	    Bill Schmidt <wschmidt@linux.ibm.com>,
	    Segher Boessenkool <segher@kernel.crashing.org>
Subject: Re: [PATCH V5] PR88497 - Extend reassoc for vector bit_field_ref
Date: Fri, 12 Jul 2019 10:07:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.20.1907121206170.2976@zhemvz.fhfr.qr> (raw)
In-Reply-To: <35c78672-18e1-960d-06a4-45e5ebfb1097@linux.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 3423 bytes --]

On Thu, 11 Jul 2019, Kewen.Lin wrote:

> Hi Richard,
> 
> on 2019/7/10 下午7:50, Richard Biener wrote:
> > On Mon, 8 Jul 2019, Kewen.Lin wrote:
> > 
> > 
> > +      tree rhs = gimple_assign_rhs1 (oe1def);
> > +      tree vec = TREE_OPERAND (rhs, 0);
> > +      tree vec_type = TREE_TYPE (vec);
> > +
> > +      if (TREE_CODE (vec) != SSA_NAME || !VECTOR_TYPE_P (vec_type))
> > +       continue;
> > ...
> > +      /* Ignore it if target machine can't support this VECTOR type.  */
> > +      if (!VECTOR_MODE_P (TYPE_MODE (vec_type)))
> > +       continue;
> > 
> > put the check below next to the one above, it's cheaper than the
> > poly-int stuff that currently preceeds it.
> > 
> > +      v_info_ptr *info_ptr = v_info_map.get (vec);
> > +      if (info_ptr)
> > +       {
> > 
> > there is get_or_insert which enables you to mostly merge the two cases
> > with a preceeding
> > 
> >   if (!existed)
> >     v_info_ptr = new v_info;
> > 
> > also eliding the extra hash-lookup the put operation otherwise requires.
> > 
> > +  for (hash_map<tree, v_info_ptr>::iterator it = v_info_map.begin ();
> > +       it != v_info_map.end (); ++it)
> > +    {
> > +      tree cand_vec = (*it).first;
> > +      v_info_ptr cand_info = (*it).second;
> > +      unsigned int num_elems = VECTOR_CST_NELTS (cand_vec).to_constant 
> > ();
> > 
> > please add a quick out like
> > 
> >       if (cand_info->length () != num_elems)
> >         continue;
> > 
> > since to have no holes and no overlap you need exactly that many.
> > 
> > I think you can avoid the somewhat ugly mode_to_total counter array.
> > Since you have sorted valid_vecs after modes simply do
> > 
> >   for (unsigned i = 0; i < valid_vecs.length () - 1; ++i)
> >     {
> >       tree tvec = valid_vecs[i];
> >       enum machine_mode mode = TYPE_MODE (TREE_TYPE (tvec));
> > 
> > (please don't use unsigned int for mode!)
> > 
> >       /* Skip modes with only a single candidate.  */
> >       if (TYPE_MODE (TREE_TYPE (valid_vecs[i+1])) != mode)
> >         continue;
> > 
> >       do
> >         {
> > ...
> >         }
> >       while (...)
> > 
> > Richard.
> > 
> 
> Thanks a lot for your comments, I've updated the patch accordingly (also
> including Segher's comments on test cases).
> 
> Bootstrapped and regression test passed on powerpc64le-unknown-linux-gnu
> and x86_64-linux-gnu.
> 
> Is it ok for trunk? 

This is OK.

Thanks,
Richard.

> Thanks,
> Kewen
> 
> -----------
> 
> gcc/ChangeLog
> 
> 2019-07-11  Kewen Lin  <linkw@gcc.gnu.org>
> 
> 	PR tree-optimization/88497
> 	* tree-ssa-reassoc.c (reassociate_bb): Swap the positions of
> 	GIMPLE_BINARY_RHS check and gimple_visited_p check, call new
> 	function undistribute_bitref_for_vector.
> 	(undistribute_bitref_for_vector): New function.
> 	(cleanup_vinfo_map): Likewise.
> 	(sort_by_mach_mode): Likewise.
> 
> gcc/testsuite/ChangeLog
> 
> 2019-07-11  Kewen Lin  <linkw@gcc.gnu.org>
> 
> 	* gcc.dg/tree-ssa/pr88497-1.c: New test.
> 	* gcc.dg/tree-ssa/pr88497-2.c: Likewise.
> 	* gcc.dg/tree-ssa/pr88497-3.c: Likewise.
> 	* gcc.dg/tree-ssa/pr88497-4.c: Likewise.
> 	* gcc.dg/tree-ssa/pr88497-5.c: Likewise.
> 	* gcc.dg/tree-ssa/pr88497-6.c: Likewise.
> 	* gcc.dg/tree-ssa/pr88497-7.c: Likewise.
> 
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany;
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah; HRB 21284 (AG Nürnberg)

      reply	other threads:[~2019-07-12 10:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20  3:33 [PATCH V3] " Kewen.Lin
2019-04-03 22:00 ` [PING] " Kewen.Lin
2019-05-05  6:15 ` Kewen.Lin
2019-05-21  2:03   ` Kewen.Lin
2019-06-11  2:46     ` [PING^4] " Kewen.Lin
2019-06-26  5:37       ` [PING^5] " Kewen.Lin
2019-07-02 12:43 ` Richard Biener
2019-07-03  3:20   ` Kewen.Lin
2019-07-03 12:21     ` Richard Biener
2019-07-08  8:14       ` [PATCH V4] " Kewen.Lin
2019-07-08 16:56         ` Segher Boessenkool
2019-07-09  2:37           ` Kewen.Lin
2019-07-09 16:51             ` Segher Boessenkool
2019-07-10 11:54         ` Richard Biener
2019-07-11 13:51           ` [PATCH V5] " Kewen.Lin
2019-07-12 10:07             ` Richard Biener [this message]

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.1907121206170.2976@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=linkw@linux.ibm.com \
    --cc=segher@kernel.crashing.org \
    --cc=wschmidt@linux.ibm.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).