public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Siddhesh Poyarekar <siddhesh@gotplt.org>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH v2 0/3] gimple-fold improvements
Date: Mon, 15 Nov 2021 23:03:12 +0530	[thread overview]
Message-ID: <20211115173315.1857598-1-siddhesh@gotplt.org> (raw)
In-Reply-To: <20211111194116.1626980-1-siddhesh@gotplt.org>

This patchset improves folding in cases where input lengths
and/or destination sizes may not be constant but are range bound.

Tested on x86_64 with a full bootstrap build and verified that there are
no regressions resulting from this patchset.  I double-checked that the
run was current and I wasn't checking logs of a stale build.

I tested builds of bash and wpa_supplicant with this patchset.
wpa_supplicant ends up with 30 fewer __memcpy_chk calls, of which 14 are
completely optimized away and the rest transformed to __memcpy. 

In bash, 3 __memcpy_chk calls are optimized away completely in addition
to a couple of memmove and strcpy chk variants being transformed into
regular calls.

Changes from v1:

- Use dump_* functions instead of directly using dump_file
- Bring back warnings and reduce scope of changes to strncat to only
  using ranges to determine if call can be simplified to strcat.
- Renamed known_safe to known_lower

Siddhesh Poyarekar (3):
  gimple-fold: Transform stp*cpy_chk to str*cpy directly
  gimple-fold: Use ranges to simplify _chk calls
  gimple-fold: Use ranges to simplify strncat and snprintf

 gcc/gimple-fold.c                       | 343 ++++++++++--------------
 gcc/testsuite/gcc.dg/Wobjsize-1.c       |   5 +-
 gcc/testsuite/gcc.dg/fold-stringops-1.c |  23 ++
 gcc/testsuite/gcc.dg/fold-stringops-2.c |  63 +++++
 gcc/testsuite/gcc.dg/fold-stringops-3.c |  18 ++
 5 files changed, 256 insertions(+), 196 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/fold-stringops-1.c
 create mode 100644 gcc/testsuite/gcc.dg/fold-stringops-2.c
 create mode 100644 gcc/testsuite/gcc.dg/fold-stringops-3.c

-- 
2.31.1


  parent reply	other threads:[~2021-11-15 17:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 19:41 [PATCH " Siddhesh Poyarekar
2021-11-11 19:41 ` [PATCH 1/3] gimple-fold: Transform stp*cpy_chk to str*cpy directly Siddhesh Poyarekar
2021-11-12 17:16   ` Prathamesh Kulkarni
2021-11-14  5:48     ` Siddhesh Poyarekar
2021-11-11 19:41 ` [PATCH 2/3] gimple-fold: Use ranges to simplify _chk calls Siddhesh Poyarekar
2021-11-11 19:41 ` [PATCH 3/3] gimple-fold: Use ranges to simplify strncat and snprintf Siddhesh Poyarekar
2021-11-15 10:41   ` Siddhesh Poyarekar
2021-11-15 17:33 ` Siddhesh Poyarekar [this message]
2021-11-15 17:33   ` [PATCH v2 1/3] gimple-fold: Transform stp*cpy_chk to str*cpy directly Siddhesh Poyarekar
2021-11-15 19:17     ` Jeff Law
2021-11-15 17:33   ` [PATCH v2 2/3] gimple-fold: Use ranges to simplify _chk calls Siddhesh Poyarekar
2021-11-15 20:25     ` Jeff Law
2021-11-15 22:53       ` Siddhesh Poyarekar
2021-11-15 17:33   ` [PATCH v2 3/3] gimple-fold: Use ranges to simplify strncat and snprintf Siddhesh Poyarekar
2021-11-15 19:38     ` 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=20211115173315.1857598-1-siddhesh@gotplt.org \
    --to=siddhesh@gotplt.org \
    --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).