public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Gary Oblock <gary@amperecomputing.com>
To: "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: A couple GIMPLE questions
Date: Sat, 5 Sep 2020 23:19:05 +0000	[thread overview]
Message-ID: <BYAPR01MB5464377E648E7132583DEAC8C62A0@BYAPR01MB5464.prod.exchangelabs.com> (raw)

First off one of the questions just me being curious but
second is quite serious. Note, this is GIMPLE coming
into my optimization and not something I've modified.

Here's the C code:

type_t *
do_comp( type_t *data, size_t len)
{
  type_t *res;
  type_t *x = min_of_x( data, len);
  type_t *y = max_of_y( data, len);

  res = y;
  if ( x < y ) res = 0;
  return res;
}

And here's the resulting GIMPLE:

;; Function do_comp.constprop (do_comp.constprop.0, funcdef_no=5, decl_uid=4392, cgraph_uid=3, symbol_order=68) (executed once)

do_comp.constprop (struct type_t * data)
{
  struct type_t * res;
  struct type_t * x;
  struct type_t * y;
  size_t len;

  <bb 5> [local count: 1073741824]:

  <bb 2> [local count: 1073741824]:
  x_2 = min_of_x (data_1(D), 10000);
  y_3 = max_of_y (data_1(D), 10000);
  if (x_2 < y_3)
    goto <bb 3>; [29.00%]
  else
    goto <bb 4>; [71.00%]

  <bb 3> [local count: 311385128]:

  <bb 4> [local count: 1073741824]:
  # res_4 = PHI <y_3(2), 0B(3)>
  return res_4;

}

The silly question first. In the "if" stmt how does GCC
get those probabilities? Which it shows as 29.00% and
71.00%. I believe they should both be 50.00%.

The serious question is what is going on with this phi?
    res_4 = PHI <y_3(2), 0B(3)>

This makes zero sense practicality wise to me and how is
it supposed to be recognized and used? Note, I really do
need to transform the "0B" into something else for my
structure reorganization optimization.

Thanks,

Gary Oblock




CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and contains information that is confidential and proprietary to Ampere Computing or its subsidiaries. It is to be used solely for the purpose of furthering the parties' business relationship. Any unauthorized review, copying, or distribution of this email (or any attachments thereto) is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently delete the original and any copies of this email and any attachments thereto.

             reply	other threads:[~2020-09-05 23:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-05 23:19 Gary Oblock [this message]
2020-09-06  6:29 ` Marc Glisse
2020-09-06  7:38   ` Gary Oblock
2020-09-06 16:43     ` Richard Biener
2020-09-06  7:42   ` Gary Oblock

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=BYAPR01MB5464377E648E7132583DEAC8C62A0@BYAPR01MB5464.prod.exchangelabs.com \
    --to=gary@amperecomputing.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).