public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Properly honor param_max_fsm_thread_path_insns in backwards threader
Date: Fri, 5 Aug 2022 10:35:11 -0600	[thread overview]
Message-ID: <f47466b5-b738-7183-cf0c-6299f52bebd8@gmail.com> (raw)
In-Reply-To: <20220802130109.AD89F385381B@sourceware.org>



On 8/2/2022 7:00 AM, Richard Biener via Gcc-patches wrote:
> I am trying to make sense of back_threader_profitability::profitable_path_p
> and the first thing I notice is that we do
>
>    /* Threading is profitable if the path duplicated is hot but also
>       in a case we separate cold path from hot path and permit optimization
>       of the hot path later.  Be on the agressive side here. In some testcases,
>       as in PR 78407 this leads to noticeable improvements.  */
>    if (m_speed_p
>        && ((taken_edge && optimize_edge_for_speed_p (taken_edge))
>            || contains_hot_bb))
>      {
>        if (n_insns >= param_max_fsm_thread_path_insns)
>          {
>            if (dump_file && (dump_flags & TDF_DETAILS))
>              fprintf (dump_file, "  FAIL: Jump-thread path not considered: "
>                       "the number of instructions on the path "
>                       "exceeds PARAM_MAX_FSM_THREAD_PATH_INSNS.\n");
>            return false;
>          }
> ...
>      }
>    else if (!m_speed_p && n_insns > 1)
>      {
>        if (dump_file && (dump_flags & TDF_DETAILS))
>          fprintf (dump_file, "  FAIL: Jump-thread path not considered: "
>                   "duplication of %i insns is needed and optimizing for size.\n",
>                   n_insns);
>        return false;
>      }
> ...
>    return true;
>
> thus we apply the n_insns >= param_max_fsm_thread_path_insns only
> to "hot paths".  The comment above this isn't entirely clear whether
> this is by design ("Be on the aggressive side here ...") but I think
> this is a mistake.  In fact the "hot path" check seems entirely
> useless since if the path is not hot we simply continue threading it.
I think the intent here was to allow more insns to be copied if the path 
was hot than if it was not not hot.     But the logic seems a bit 
convoluted here.

jeff

       reply	other threads:[~2022-08-05 16:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220802130109.AD89F385381B@sourceware.org>
2022-08-05 16:35 ` Jeff Law [this message]
2022-08-02 13:00 Richard Biener
  -- strict thread matches above, loose matches on Subject: below --
2022-08-02 13:00 Richard Biener
2022-08-02 13:00 Richard Biener
     [not found] <04261.122080204410800126@us-mta-529.us.mimecast.lan>
2022-08-02 10:21 ` Aldy Hernandez
2022-08-02 11:45   ` Richard Biener
2022-08-02 11:54     ` Aldy Hernandez
2022-08-02 11:59       ` Richard Biener
2022-08-02 12:03         ` Aldy Hernandez
2022-08-02 13:29           ` Richard Biener
2022-08-02 14:25             ` Aldy Hernandez
2022-08-02 16:31         ` Jan Hubicka
2022-08-03  9:58           ` Richard Biener
2022-08-02  8:41 Richard Biener
2022-08-02  8:41 Richard Biener
2022-08-02  8:41 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=f47466b5-b738-7183-cf0c-6299f52bebd8@gmail.com \
    --to=jeffreyalaw@gmail.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).