public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/61110] New: Simplify value_replacement in phiopt
Date: Thu, 08 May 2014 13:40:00 -0000	[thread overview]
Message-ID: <bug-61110-4@http.gcc.gnu.org/bugzilla/> (raw)

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61110

            Bug ID: 61110
           Summary: Simplify value_replacement in phiopt
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glisse at gcc dot gnu.org

The patch for PR 59100 introduced 2 functions neutral_element_p and
absorbing_element_p. I don't know why I did that. When we see:
(x != 0) ? x + y : y
instead of asking if 0 is a neutral element of + on the left, it is easier to
try to fold "0 + y" (I replaced x with the rhs of the comparison) and check if
that matches "y". This handles neutral and absorbing as a single case and is
even more general (we could also do it for the non-constant case: (x!=y) ? x|y
: x). We could even imagine generalizing it to the case where middle_bb has 2
or 3 statements (but the cost analysis may need to be refined then).

I probably won't do it immediately (the current code works) but I didn't want
this idea to be forgotten.


             reply	other threads:[~2014-05-08 13:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-08 13:40 glisse at gcc dot gnu.org [this message]
2014-05-17 12:48 ` [Bug tree-optimization/61110] " glisse at gcc dot gnu.org
2014-11-05 16:11 ` pinskia at gcc dot gnu.org
2023-10-31  5:08 ` pinskia at gcc dot gnu.org
2024-05-02 21:47 ` pinskia at gcc dot gnu.org
2024-05-07 21:43 ` 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-61110-4@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).