public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Roger Sayle <roger@nextmovesoftware.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] PR tree-optimization/83907: Improved memset handling in strlen pass.
Date: Wed, 2 Mar 2022 12:32:47 -0700	[thread overview]
Message-ID: <7da496e6-ee9b-e6ae-f4ed-dbadeef694ed@gmail.com> (raw)
In-Reply-To: <014201d8267a$206e1320$614a3960$@nextmovesoftware.com>



On 2/20/2022 9:51 AM, Roger Sayle wrote:
> This patch implements the missed optimization enhancement PR 83907,
> by handling memset with a constant byte value in tree-ssa's strlen
> optimization pass.  Effectively, this treats memset(dst,'x',3) as
> it would memcpy(dst,"xxx",3).
>
> This patch also includes a tweak to handle_store to address another
> missed optimization observed in the related test case pr83907-2.c.
> The consecutive byte stores to memory get coalesced into a vector
> write of a vector const, but unfortunately tree-ssa-strlen's
> handle_store didn't previously handle the (unusual) case where the
> stored "string" starts with a zero byte but also contains non-zero
> bytes.
>
> This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
> and make -k check with no new failures.  Ok for mainline?
>
>
> 2022-02-20  Roger Sayle  <roger@nextmovesoftware.com>
>
> gcc/ChangeLog
> 	PR tree-optimization/83907
> 	* tree-ssa-strlen.cc (handle_builtin_memset): Record a strinfo
> 	for memset with an constant char value.
> 	(handle_store): Improved handling of stores with a first byte
> 	of zero, but not storing_all_zeros_p.
>
> gcc/testsuite/ChangeLog
> 	PR tree-optimization/83907
> 	* gcc.dg/tree-ssa/pr83907-1.c: New test case.
> 	* gcc.dg/tree-ssa/pr83907-2.c: New test case.
Deferring to stage1.
jeff


  reply	other threads:[~2022-03-02 19:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-20 16:51 Roger Sayle
2022-03-02 19:32 ` Jeff Law [this message]
2022-05-12  7:14   ` Roger Sayle
2022-05-12 15:27 ` Jeff Law

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=7da496e6-ee9b-e6ae-f4ed-dbadeef694ed@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=roger@nextmovesoftware.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).