public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Bin.Cheng" <amker.cheng@gmail.com>
To: "Martin Liška" <mliska@suse.cz>
Cc: Richard Biener <richard.guenther@gmail.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
		Jan Hubicka <hubicka@ucw.cz>
Subject: Re: [PATCH 3/3] Enhance dumps of IVOPTS
Date: Thu, 12 May 2016 13:51:00 -0000	[thread overview]
Message-ID: <CAHFci293J8fgPeWBwASrj79VqoOH50cihRFg_75c5s=vw0_ONA@mail.gmail.com> (raw)
In-Reply-To: <5734737F.2050003@suse.cz>

On Thu, May 12, 2016 at 1:13 PM, Martin Liška <mliska@suse.cz> wrote:
> On 05/10/2016 03:16 PM, Bin.Cheng wrote:
>> Another way is to remove the use of id for struct iv_inv_expr_ent once
>> for all.  We can change iv_ca.used_inv_expr and cost_pair.inv_expr_id
>> to pointers, and rename iv_inv_expr_ent.id to count and use this to
>> record reference number in iv_ca.  This if-statement on dump_file can
>> be saved.  Also I think it simplifies current code a bit.  For now,
>> there are id <-> struct maps for different structures in IVOPT which
>> make it not straightforward.
>
> Hi.
>
> I'm sending second version of the patch. I tried to follow your advices, but
> because of a iv_inv_expr_ent can simultaneously belong to multiply iv_cas,
> putting counter to iv_inv_expr_ent does not works. Instead of that, I've
> decided to replace used_inv_expr with a hash_map that contains used inv_exps
> and where value of the map is # of usages.
>
> Further questions:
> + iv_inv_expr_ent::id can be now removed as it's used just for purpose of dumps
> Group 0:
>   cand  cost    scaled  freq    compl.  depends on
>   5     2       2.00    1.000
>   6     4       4.00    1.001    inv_expr:0
>   7     4       4.00    1.001    inv_expr:1
>   8     4       4.00    1.001    inv_expr:2
>
> That can be replaced with print_generic_expr, but I think using ids makes the dump
> output more clear.
I am okay with keeping id.  Could you please dump all inv_exprs in a
single section like
<Invariant Exprs>:
inv_expr 0: print_generic_expr
inv_expr 1: ...

Then only dump the id afterwards?

>
> + As check_GNU_style.sh reported multiple 8 spaces issues in hunks I've touched, I decided
> to fix all 8 spaces issues. Hope it's fine.
>
> I'm going to test the patch.
> Thoughts?

Some comments on the patch embedded.

>
> +/* Forward declaration.  */
Not necessary.
> +struct iv_inv_expr_ent;
> +

>
>  /* Stores EXPR in DATA->inv_expr_tab, and assigns it an inv_expr_id.  */
>
> -static int
> +static iv_inv_expr_ent *
>  get_expr_id (struct ivopts_data *data, tree expr)
We are not returning id any more, maybe rename to record_inv_expr or else.

>  {
>    struct iv_inv_expr_ent ent;
> @@ -4806,13 +4809,13 @@ get_expr_id (struct ivopts_data *data, tree expr)
>    ent.hash = iterative_hash_expr (expr, 0);
>    slot = data->inv_expr_tab->find_slot (&ent, INSERT);
>    if (*slot)
> -    return (*slot)->id;
> +    return *slot;
>
>    *slot = XNEW (struct iv_inv_expr_ent);
>    (*slot)->expr = expr;
>    (*slot)->hash = ent.hash;
>    (*slot)->id = data->max_inv_expr_id++;
> -  return (*slot)->id;
> +  return *slot;
This could be changed to
  if (!*slot)
    {
      //new and insert
    }
  return *slot;
>  }
>
>  /* Returns the pseudo expr id if expression UBASE - RATIO * CBASE
> @@ -4820,10 +4823,10 @@ get_expr_id (struct ivopts_data *data, tree expr)
>     ADDRESS_P is a flag indicating if the expression is for address
>     computation.  */
>
> -static int
> +static iv_inv_expr_ent *
>  get_loop_invariant_expr_id (struct ivopts_data *data, tree ubase,
> -                            tree cbase, HOST_WIDE_INT ratio,
> -                            bool address_p)
> +                tree cbase, HOST_WIDE_INT ratio,
> +                bool address_p)
Rename function name here too.
>  {

> @@ -5988,9 +5992,9 @@ determine_group_iv_costs (struct ivopts_data *data)
>            if (group->cost_map[j].depends_on)
>          bitmap_print (dump_file,
>                    group->cost_map[j].depends_on, "","");
> -          if (group->cost_map[j].inv_expr_id != -1)
> +        if (group->cost_map[j].inv_expr != NULL)
>          fprintf (dump_file, " inv_expr:%d",
> -             group->cost_map[j].inv_expr_id);
> +             group->cost_map[j].inv_expr->id);
Dump inv_expr in another column thus it won't appear under depends_on
in dump.  Also make it preceding depends_on which is a bitmap.

While we are on this one before the other two, could you please make
this independent so it can be committed after rework?

Thanks,
bin

>
> Martin

  reply	other threads:[~2016-05-12 13:51 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-29 11:58 [PATCH 0/3] IVOPTS: support profiling marxin
2016-04-29 11:58 ` [PATCH 1/3] Encapsulate comp_cost within a class with methods marxin
2016-05-16 10:14   ` Bin.Cheng
2016-05-16 13:55     ` Martin Liška
2016-05-19 10:23       ` Martin Liška
2016-05-19 11:24         ` Bin.Cheng
2016-05-26 21:02           ` Martin Liška
2016-04-29 11:58 ` [PATCH 2/3] Add profiling support for IVOPTS marxin
2016-05-16 13:56   ` Martin Liška
2016-05-16 22:27     ` Bin.Cheng
2016-05-19 10:28       ` Martin Liška
2016-05-20 10:04         ` Bin.Cheng
2016-05-24 10:19         ` Bin.Cheng
2016-05-24 10:33           ` Bin.Cheng
2016-05-24 11:01           ` Bin.Cheng
2016-05-30 19:51           ` Martin Liška
2016-04-29 11:58 ` [PATCH 3/3] Enhance dumps of IVOPTS marxin
2016-05-06  9:19   ` Martin Liška
2016-05-09  9:47     ` Richard Biener
2016-05-10 13:16       ` Bin.Cheng
2016-05-11 14:18         ` Martin Liška
2016-05-12 12:14         ` Martin Liška
2016-05-12 13:51           ` Bin.Cheng [this message]
2016-05-12 16:42             ` Martin Liška
2016-05-13  9:43               ` Bin.Cheng
2016-05-13 10:44                 ` Martin Liška
2016-05-13 12:12                   ` H.J. Lu
2016-05-13 12:39                     ` Martin Liška
2016-05-13 12:44                       ` Kyrill Tkachov
2016-05-13 12:47                         ` Richard Biener
2016-05-13 12:51                           ` Martin Liška
2016-05-13 14:17                             ` H.J. Lu
2016-05-13 14:46                               ` H.J. Lu
2016-05-03  9:28 ` [PATCH 0/3] IVOPTS: support profiling Bin.Cheng

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='CAHFci293J8fgPeWBwASrj79VqoOH50cihRFg_75c5s=vw0_ONA@mail.gmail.com' \
    --to=amker.cheng@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=mliska@suse.cz \
    --cc=richard.guenther@gmail.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).