public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@gmail.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [RFC/SCCVN] Handle BIT_INSERT_EXPR in vn_nary_op_eq
Date: Thu, 13 Jul 2017 04:18:00 -0000	[thread overview]
Message-ID: <CA+=Sn1kkNUy+eR5RUu9ijJwoFivGN_V98EPE=zPkBVKzRkNUNw@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1707130557300.2554@stedding.saclay.inria.fr>

On Wed, Jul 12, 2017 at 9:10 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
> On Wed, 12 Jul 2017, Andrew Pinski wrote:
>
>> Hi,
>>  Unlike most other expressions, BIT_INSERT_EXPR has an implicit
>> operand of the precision/size of the second operand.  This means if we
>> have an integer constant for the second operand and that compares to
>> the same constant value, vn_nary_op_eq would return that these two
>> expressions are the same.  But in the case I was looking into the
>> integer constants had different types, one with 1 bit precision and
>> the other with 2 bit precision which means the BIT_INSERT_EXPR were
>> not equal at all.
>>
>> This patches the problem by checking to see if BIT_INSERT_EXPR's
>> operand 1's (second operand) type  has different precision to return
>> false.
>>
>> Is this the correct location or should we be checking for this
>> differently?  If this is the correct location, is the patch ok?
>> Bootstrapped and tested on aarch64-linux-gnu with no regressions (and
>> also tested with a few extra patches to expose BIT_INSERT_EXPR).
>>
>> Thanks,
>> Andrew Pinski
>>
>> ChangeLog:
>> * tree-ssa-sccvn.c (vn_nary_op_eq): Check BIT_INSERT_EXPR's operand 1
>> to see if the types precision matches.
>
>
> Hello,
>
> since BIT_INSERT_EXPR is implicitly an expression with 4 arguments, it makes
> sense that we may need a few such special cases. But shouldn't the hash
> function be in sync with the equality comparator? Does operand_equal_p need
> the same?

The hash function does not need to be exactly the same.  The only
requirement there is if vn_nary_op_eq returns true then the hash has
to be the same.  Now we could improve the hash by using the precision
which will allow us not to compare as much in some cases.

Yes operand_equal_p needs the same handling; I did not notice that
until you mention it..
Right now it does:
        case BIT_INSERT_EXPR:
          return OP_SAME (0) && OP_SAME (1) && OP_SAME (2);

Thanks,
Andrew Pinski

>
> --
> Marc Glisse

  reply	other threads:[~2017-07-13  4:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-13  1:19 Andrew Pinski
2017-07-13  4:14 ` Marc Glisse
2017-07-13  4:18   ` Andrew Pinski [this message]
2017-07-17 10:03     ` Richard Biener
2017-07-19 16:10       ` Andrew Pinski
2017-07-19 18:13         ` Richard Biener
2017-07-21 17:16           ` Andrew Pinski

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='CA+=Sn1kkNUy+eR5RUu9ijJwoFivGN_V98EPE=zPkBVKzRkNUNw@mail.gmail.com' \
    --to=pinskia@gmail.com \
    --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).