public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Subject: Re: [PATCH] handle bzero/bcopy in DSE and aliasing (PR 80933, 80934)
Date: Fri, 16 Jun 2017 20:52:00 -0000	[thread overview]
Message-ID: <5d3255b6-ce77-3255-5a7f-229a9dddfec7@gmail.com> (raw)
In-Reply-To: <CAFiYyc10TsqSb4or3OjkbEWSw3JZRf4HmfgcBNpg_FOrdWNqgw@mail.gmail.com>

> +static bool
> +gimple_fold_builtin_bcmp (gimple_stmt_iterator *gsi)
> +{
>
> +  /* Transform bcmp (a, b, len) into memcmp (a, b, len).  */
> +
> +  gimple *stmt = gsi_stmt (*gsi);
> +  tree a = gimple_call_arg (stmt, 0);
> +  tree b = gimple_call_arg (stmt, 1);
> +  tree len = gimple_call_arg (stmt, 2);
> +
> +  gimple_seq seq = NULL;
> +  gimple *repl = gimple_build_call (fn, 3, a, b, len);
> +  gimple_seq_add_stmt_without_update (&seq, repl);
> +  gsi_replace_with_seq_vops (gsi, seq);
>
> given they have the same prototype you can do like gimple_fold_builtin_stpcpy:
>
>   gimple_call_set_fndecl (stmt, fn);
>   fold_stmt (gsi);
>
> That works even with bcopy -> memmove if you swap arguments.
>
> Ok with that changes.

I made these changes along with those mentioned downthread and
committed r249278.

Martin

  parent reply	other threads:[~2017-06-16 20:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01 20:53 Martin Sebor
2017-06-02 11:12 ` Richard Biener
2017-06-04 15:36   ` Bernhard Reutner-Fischer
2017-06-06 16:54     ` Jeff Law
2017-06-07  3:26   ` Martin Sebor
2017-06-07  8:23     ` Richard Biener
2017-06-07 14:46       ` Martin Sebor
2017-06-07 18:37         ` Bernhard Reutner-Fischer
2017-06-07 20:01           ` Marc Glisse
2017-06-07 20:12             ` Martin Sebor
2017-06-08  2:33               ` Martin Sebor
2017-06-08  7:51                 ` Richard Biener
2017-06-08 16:29                   ` Martin Sebor
2017-06-09 12:35                     ` Richard Biener
2017-06-09 13:04                       ` Jakub Jelinek
2017-06-09 13:36                         ` Richard Biener
2017-06-16 20:52                       ` Martin Sebor [this message]
2017-06-07 20:23           ` Joseph Myers

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=5d3255b6-ce77-3255-5a7f-229a9dddfec7@gmail.com \
    --to=msebor@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rep.dot.nop@gmail.com \
    --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).