public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/79119] absolute value of a pointer difference can be assumed to be less than or equal to PTRDIFF_MAX
Date: Thu, 27 Apr 2023 22:31:48 +0000	[thread overview]
Message-ID: <bug-79119-4-Bu9rtCRAf5@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-79119-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79119

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So a couple of things need to happen really:
optimized now:
  if (p_10 < q_12)
    goto <bb 3>; [50.00%]
  else
    goto <bb 4>; [50.00%]

  <bb 3> [local count: 536870913]:
  _3 = _22 - _21;
  _4 = _3 /[ex] 4;
  iftmp.0_14 = (long unsigned int) _4;
  goto <bb 5>; [100.00%]

  <bb 4> [local count: 536870913]:
  _5 = _21 - _22;
  _6 = _5 /[ex] 4;
  iftmp.0_13 = (long unsigned int) _6;

  <bb 5> [local count: 1073741824]:
  # iftmp.0_7 = PHI <iftmp.0_14(3), iftmp.0_13(4)>

I have a patch which is able to move the cast out of the PHI (will be posting
it today or tomorrow).
The next thing is we need to move the /[ext] 4 out of the PHI, I have not
extended PHIOPT to do that just yet (just extended it to handle unary
operations though).
And then we have to see the abs but with _22/_21 being unrelated to p_10/q_12
except with a cast, it might be hard. I am looking into a patch for the case
where if _22/_21 was in the conditional.

       reply	other threads:[~2023-04-27 22:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-79119-4@http.gcc.gnu.org/bugzilla/>
2023-04-27 22:31 ` pinskia at gcc dot gnu.org [this message]
2023-05-02  0:15 ` pinskia at gcc dot gnu.org
2023-05-06 20:20 ` pinskia at gcc dot gnu.org

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=bug-79119-4-Bu9rtCRAf5@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).