From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] tree-optimization/91838 - fix FAIL of g++.dg/opt/pr91838.C
Date: Thu, 27 Jul 2023 14:30:15 +0200 [thread overview]
Message-ID: <ZMJjV5nzeJbLbQgZ@tucnak> (raw)
In-Reply-To: <81140.123072708005901359@us-mta-160.us.mimecast.lan>
On Thu, Jul 27, 2023 at 12:00:56PM +0000, Richard Biener wrote:
> The following fixes the lack of simplification of a vector shift
> by an out-of-bounds shift value. For scalars this is done both
> by CCP and VRP but vectors are not handled there. This results
> in PR91838 differences in outcome dependent on whether a vector
> shift ISA is available and thus vector lowering does or does not
> expose scalar shifts here.
>
> The following adds a match.pd pattern to catch uniform out-of-bound
> shifts, simplifying them to zero when not sanitizing shift amounts.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu.
>
> OK?
>
> Thanks,
> Richard.
>
> PR tree-optimization/91838
> * match.pd (([rl]shift @0 out-of-bounds) -> zero): New pattern.
The !(flag_sanitize & SANITIZE_SHIFT_EXPONENT)
should be !sanitize_flags_p (SANITIZE_SHIFT_EXPONENT)
or maybe even
GIMPLE || !sanitize_flags_p (SANITIZE_SHIFT_EXPONENT)
because the shift ubsan instrumentation is done on GENERIC, so it can be
optimized on GIMPLE even with ubsan.
Otherwise LGTM.
Jakub
next parent reply other threads:[~2023-07-27 12:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <81140.123072708005901359@us-mta-160.us.mimecast.lan>
2023-07-27 12:30 ` Jakub Jelinek [this message]
2023-07-27 13:07 ` Richard Biener
2023-07-27 13:09 ` Jakub Jelinek
2023-07-27 12:00 Richard Biener
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=ZMJjV5nzeJbLbQgZ@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
/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).