public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Ploujnikov <michael.ploujnikov@oracle.com>
To: gcc@gcc.gnu.org
Subject: Understanding tree_swap_operands_p wrt SSA name versions
Date: Tue, 19 Jun 2018 18:55:00 -0000	[thread overview]
Message-ID: <5b1a8e4b-c0c5-69f7-1800-605e0b844acb@oracle.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1167 bytes --]

Hi everyone,

(I hope this is the right place to ask, if not my apologies; please
point me in the right direction)

I'm trying to get a better understanding of the following part in
tree_swap_operands_p():

  /* It is preferable to swap two SSA_NAME to ensure a canonical form
     for commutative and comparison operators.  Ensuring a canonical
     form allows the optimizers to find additional redundancies without
     having to explicitly check for both orderings.  */
  if (TREE_CODE (arg0) == SSA_NAME
      && TREE_CODE (arg1) == SSA_NAME
      && SSA_NAME_VERSION (arg0) > SSA_NAME_VERSION (arg1))
    return 1;

My questions in no particular order: It looks like this was added in
2004. I couldn't find any info other than what's in the corresponding
commit (cc0bdf913) so I'm wondering if the canonical form/order still
relevant/needed today? Does the ordering have to be done based on the
name versions specifically? Or can it be based on something more
intrinsic to the input source code rather than a GCC internal value, eg:
would alphabetic sort order of the variable names be a reasonable
replacement?

Thanks,
- Michael


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

             reply	other threads:[~2018-06-19 18:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-19 18:55 Michael Ploujnikov [this message]
2018-06-20  7:50 ` Jeff Law
2018-06-20 11:35   ` Richard Biener
2018-07-03 14:57     ` Michael Ploujnikov
2018-07-03 16:46       ` Richard Biener
2018-07-03 17:55         ` Michael Ploujnikov
2018-07-03 19:09           ` Jeff Law
2018-07-04  8:53             ` Richard Biener
2018-07-15 22:19               ` Michael Ploujnikov
2018-07-16  8:31                 ` Richard Biener
2018-07-17  3:20                   ` Michael Ploujnikov
2018-07-17  9:51                     ` 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=5b1a8e4b-c0c5-69f7-1800-605e0b844acb@oracle.com \
    --to=michael.ploujnikov@oracle.com \
    --cc=gcc@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).