public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Mariam Arutunian <mariamarutunian@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [RFC/RFA] [PATCH 08/12] Add a new pass for naive CRC loops detection
Date: Tue, 28 May 2024 09:01:07 +0200	[thread overview]
Message-ID: <CAFiYyc3n09P3cGMAGXO5YdUtV6r_aLqSZcBMogpMhyRUJu7mdA@mail.gmail.com> (raw)
In-Reply-To: <CAE65F3PWUGsqZOJ=ympR_AC-fWNJFrYWS2Dqsp+GiENPmOY==w@mail.gmail.com>

On Fri, May 24, 2024 at 10:46 AM Mariam Arutunian
<mariamarutunian@gmail.com> wrote:
>
> This patch adds a new compiler pass aimed at identifying naive CRC implementations,
> characterized by the presence of a loop calculating a CRC (polynomial long division).
> Upon detection of a potential CRC, the pass prints an informational message.
>
> Performs CRC optimization if optimization level is >= 2,
> besides optimizations for size and if fno_gimple_crc_optimization given.
>
> This pass is added for the detection and optimization of naive CRC implementations,
> improving the efficiency of CRC-related computations.
>
> This patch includes only initial fast checks for filtering out non-CRCs,
> detected possible CRCs verification and optimization parts will be provided in subsequent patches.

Just a few quick questions - I'm waiting for a revision with Jeffs
comments cleared before
having a closer look.  The patch does nothing but analyze right now,
correct?  I assume
a later patch will fill in stuff in ::execute and use the return value
of loop_may_calculate_crc
(it's a bit odd to review such a "split" thing).

I think what this does fits final value replacement which lives in
tree-scalar-evolution.cc
and works from the loop-closed PHIs, trying to replace those.  I'm not
sure we want to
have a separate pass for this.  Consider a loop calculating two or
four CRCs in parallel,
replacing LC PHIs one-by-one should be able to handle this.

Richard.

>   gcc/
>
>     * Makefile.in (OBJS): Add gimple-crc-optimization.o.
>     * common.opt (fgimple-crc-optimization): New option.
>     * doc/invoke.texi (-fgimple-crc-optimization): Add documentation.
>     * gimple-crc-optimization.cc: New file.
>     * gimple.cc (set_phi_stmts_not_visited): New function.
>     (set_gimple_stmts_not_visited): Likewise.
>     (set_bbs_stmts_not_visited): Likewise.
>     * gimple.h (set_gimple_stmts_not_visited): New extern function declaration.
>     (set_phi_stmts_not_visited): New extern function declaration.
>     (set_bbs_stmts_not_visited): New extern function declaration.
>     * opts.cc (default_options_table): Add OPT_fgimple_crc_optimization.
>     (enable_fdo_optimizations): Enable gimple-crc-optimization.
>     * passes.def (pass_crc_optimization): Add new pass.
>     * timevar.def (TV_GIMPLE_CRC_OPTIMIZATION): New timevar.
>     * tree-pass.h (make_pass_crc_optimization): New extern function declaration.
>
> Signed-off-by: Mariam Arutunian <mariamarutunian@gmail.com>

  parent reply	other threads:[~2024-05-28  7:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-24  8:42 Mariam Arutunian
2024-05-28  4:20 ` Jeff Law
2024-05-29 11:12   ` Mariam Arutunian
2024-06-08 22:00     ` Jeff Law
2024-06-19 15:27       ` Mariam Arutunian
2024-05-28  7:01 ` Richard Biener [this message]
2024-05-29 22:30   ` Jeff Law
2024-05-30  7:33     ` Richard Biener
2024-05-29 12:43 ` David Malcolm
2024-06-04 13:41 Mariam Arutunian
2024-06-08 21:47 ` Jeff Law
2024-06-19 14:29   ` Mariam Arutunian

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=CAFiYyc3n09P3cGMAGXO5YdUtV6r_aLqSZcBMogpMhyRUJu7mdA@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mariamarutunian@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).