From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix PR77826
Date: Fri, 07 Oct 2016 07:36:00 -0000 [thread overview]
Message-ID: <alpine.LSU.2.11.1610070922290.26629@t29.fhfr.qr> (raw)
In-Reply-To: <alpine.DEB.2.20.1610062035030.1911@laptop-mg.saclay.inria.fr>
On Thu, 6 Oct 2016, Marc Glisse wrote:
> On Wed, 5 Oct 2016, Richard Biener wrote:
>
> > > The following will fix PR77826, the issue that in match.pd matching
> > > up two things uses operand_equal_p which is too lax about the type
> > > of the toplevel entity (at least for integer constants).
> > >
> > > Bootstrap / regtest pending on x86_64-unknown-linux-gnu.
> >
> > The following is what I have applied.
> >
> > Richard.
> >
> > 2016-10-05 Richard Biener <rguenther@suse.de>
> >
> > PR middle-end/77826
> > * genmatch.c (dt_operand::gen_match_op): Amend operand_equal_p
> > with types_match for GIMPLE code gen to handle type mismatched
> > constants properly.
>
> I don't understand the disparity between generic and gimple here. Why let
> (char)1 and (long)1 match in generic but not in gimple? And there are probably
> several transformations in match.pd that could do with an update if constants
> don't match anymore. Or did I misunderstand what the patch does?
The disparity is mostly that with GENERIC unfolded trees such as (char)1
are a bug while in GIMPLE the fact that the match.pd machinery does
valueization makes those a "feature" we have to deal with. Originally
I've restricted GENERIC as well but with its types_match_p implementation
it resulted in too many missed matches.
I agree that some transforms would need updates - I've actually tried
to implement a warning for genmatch whenever seeing a match with
(T)@0 but there isn't any good existing place to sneak that in.
> > * match.pd ((X /[ex] A) * A -> X): Properly handle converted
> > and constant A.
>
> This regressed
> int f(int*a,int*b){return 4*(int)(b-a);}
This is because (int)(b-a) could be a truncation in which case
multiplying with 4 might not result in the same value as
b-a truncated(?). The comment before the unpatched patterns
said "sign-changing conversions" but nothign actually verified this.
Might be that truncations are indeed ok now that I think about it.
Btw, do you have a better suggestion as to how to handle the original
issue rather than not relying on operand_equal_p for constants?
Richard.
next prev parent reply other threads:[~2016-10-07 7:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-04 10:34 Richard Biener
2016-10-05 11:38 ` Richard Biener
2016-10-06 18:44 ` Marc Glisse
2016-10-07 7:36 ` Richard Biener [this message]
2016-10-10 8:47 ` Marc Glisse
2016-10-11 9:09 ` Richard Biener
2016-10-11 20:35 ` Marc Glisse
2016-10-12 11:34 ` Richard Biener
2016-10-12 12:49 ` Marc Glisse
2016-10-12 13:25 ` Richard Biener
2016-10-13 8:29 ` Richard Biener
2016-10-15 21:50 ` Marc Glisse
2016-10-17 7:59 ` 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=alpine.LSU.2.11.1610070922290.26629@t29.fhfr.qr \
--to=rguenther@suse.de \
--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).