From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Disallow pointer operands for |, ^ and partly & [PR106878]
Date: Wed, 14 Sep 2022 10:47:24 +0200 [thread overview]
Message-ID: <YyGVHBpRnv1S/Z14@tucnak> (raw)
In-Reply-To: <nycvar.YFH.7.77.849.2209140752060.20505@jbgna.fhfr.qr>
On Wed, Sep 14, 2022 at 07:58:47AM +0000, Richard Biener wrote:
> > My change to match.pd (that added the two simplifications this patch
> > touches) results in more |/^/& assignments with pointer arguments,
> > but since r12-1608 we reject pointer operands for BIT_NOT_EXPR.
> >
> > Disallowing them for BIT_NOT_EXPR and allowing for BIT_{IOR,XOR,AND}_EXPR
> > leads to a match.pd maintainance nightmare (see one of the patches in the
> > PR), so either we want to allow pointer operand on BIT_NOT_EXPR (but then
> > we run into issues e.g. with the ranger which expects it can emulate
> > BIT_NOT_EXPR ~X as - 1 - X which doesn't work for pointers which don't
> > support MINUS_EXPR), or the following patch disallows pointer arguments
> > for all of BIT_{IOR,XOR,AND}_EXPR with the exception of BIT_AND_EXPR
> > with INTEGER_CST last operand (for simpler pointer realignment).
> > I had to tweak one reassoc optimization and the two match.pd
> > simplifications.
> >
> > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> OK.
Thanks.
> Did you check what breaks when we reverse the decision to allow
> BIT_AND_EXPR to align pointers alltogether? I think we don't
> have any
>
> (T')(((T)ptr) & CST) -> ptr & CST
I haven't tried that, but can try that next.
Would prefer a few days in between so if my current patch affects other
arches it is reported.
> I think for BIT_*_EXPR we want ANY_INTEGRAL_TYPE_P (well, likely
> not complex int, but ...). So if a patch to check that passes
> bootstrap that would be nice to have.
And can try that as the third step then.
Jakub
prev parent reply other threads:[~2022-09-14 8:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-14 7:43 Jakub Jelinek
2022-09-14 7:58 ` Richard Biener
2022-09-14 8:47 ` Jakub Jelinek [this message]
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=YyGVHBpRnv1S/Z14@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).