From: Richard Biener <richard.guenther@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Martin Sebor <msebor@gmail.com>,
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, 09 Jun 2017 13:36:00 -0000 [thread overview]
Message-ID: <CAFiYyc2Ac6y-LyORabxF6unnPT=4H_Ps_bDp4aftvOfMgbsc3g@mail.gmail.com> (raw)
In-Reply-To: <20170609130416.GI2154@tucnak>
On Fri, Jun 9, 2017 at 3:04 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Fri, Jun 09, 2017 at 02:35:45PM +0200, Richard Biener wrote:
>> +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.
>
> Shouldn't it also update gimple_call_fntype though, at least for memmove?
> Those differ with void const * vs. void * arguments, and also in the return
> value. At least if the old fntype is compatible with the bcopy call.
Yes. If the old fntype isn't compatible we don't reach the folding.
Richard.
> Jakub
next prev parent reply other threads:[~2017-06-09 13:36 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 [this message]
2017-06-16 20:52 ` Martin Sebor
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='CAFiYyc2Ac6y-LyORabxF6unnPT=4H_Ps_bDp4aftvOfMgbsc3g@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=msebor@gmail.com \
--cc=rep.dot.nop@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).