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/111718] Missed optimization of '(a+a)/a'
Date: Sun, 08 Oct 2023 03:52:26 +0000	[thread overview]
Message-ID: <bug-111718-4-YvQnN2wJRe@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111718-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
For comment #2 from EVRP:
Folding statement: _3 = _2 / a_5(D);
Applying pattern match.pd:934, gimple-match-4.cc:2021
gimple_simplified to _3 = 2;

Which corresponds to the match pattern:
/* Simplify (t * 2) / 2) -> t.  */
(for div (trunc_div ceil_div floor_div round_div exact_div)
 (simplify
  (div (mult:c @0 @1) @1)
  (if (ANY_INTEGRAL_TYPE_P (type))
   (if (TYPE_OVERFLOW_UNDEFINED (type))
    @0
#if GIMPLE
    (with {value_range vr0, vr1;}
     (if (INTEGRAL_TYPE_P (type)
          && get_range_query (cfun)->range_of_expr (vr0, @0)
          && get_range_query (cfun)->range_of_expr (vr1, @1)
          && range_op_handler (MULT_EXPR).overflow_free_p (vr0, vr1))
      @0))
#endif
   ))))

  parent reply	other threads:[~2023-10-08  3:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-07 11:05 [Bug tree-optimization/111718] New: " 652023330028 at smail dot nju.edu.cn
2023-10-07 15:46 ` [Bug tree-optimization/111718] " vanyacpp at gmail dot com
2023-10-08  3:03 ` 652023330028 at smail dot nju.edu.cn
2023-10-08  3:52 ` pinskia at gcc dot gnu.org [this message]
2023-10-08  4:00 ` 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-111718-4-YvQnN2wJRe@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).