public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/110963] [14 Regression] Dead Code Elimination Regression since r14-2946-g46c8c225455
Date: Tue, 15 Aug 2023 09:23:48 +0000	[thread overview]
Message-ID: <bug-110963-4-b4b1C8w87A@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110963-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:4d6132e59327e809a4d4e39fb9465dbd43775b7c

commit r14-3217-g4d6132e59327e809a4d4e39fb9465dbd43775b7c
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Aug 10 13:55:36 2023 +0200

    tree-optimization/110963 - more PRE when optimizing for size

    The following adjusts the heuristic when we perform PHI insertion
    during GIMPLE PRE from requiring at least one edge that is supposed
    to be optimized for speed to also doing insertion when the expression
    is available on all edges (but possibly with different value) and
    we'd at most have one copy from a constant.  The first ensures
    we optimize two computations on all paths to one plus a possible
    copy due to the PHI, the second makes sure we do not need to insert
    many possibly large copies from constants, disregarding the
    cummulative size cost of the register copies when they are not
    coalesced.

    The case in the testcase is

      <bb 5>
      _14 = h;
      if (_14 == 0B)
        goto <bb 7>;
      else
        goto <bb 6>;

      <bb 6>
      h = 0B;

      <bb 7>
      h.6_12 = h;

    and we want to optimize that to

      <bb 7>
      # h.6_12 = PHI <_14(5), 0B(6)>

    If we want to consider the cost of the register copies I think the
    only simplistic enough way would be to restrict the special-case to
    two incoming edges - we'd assume one register copy is coalesced
    leaving one copy from a register or from a constant.

    As with every optimization the downstream effects are probably
    bigger than what we can locally estimate.

            PR tree-optimization/110963
            * tree-ssa-pre.cc (do_pre_regular_insertion): Also insert
            a PHI node when the expression is available on all edges
            and we insert at most one copy from a constant.

            * gcc.dg/tree-ssa/ssa-pre-34.c: New testcase.

  parent reply	other threads:[~2023-08-15  9:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09 19:42 [Bug tree-optimization/110963] New: " theodort at inf dot ethz.ch
2023-08-09 19:43 ` [Bug tree-optimization/110963] " pinskia at gcc dot gnu.org
2023-08-09 19:52 ` pinskia at gcc dot gnu.org
2023-08-10  6:51 ` rguenth at gcc dot gnu.org
2023-08-10 11:18 ` rguenth at gcc dot gnu.org
2023-08-10 11:47 ` rguenth at gcc dot gnu.org
2023-08-10 12:13 ` theodort at inf dot ethz.ch
2023-08-10 12:20 ` rguenther at suse dot de
2023-08-10 12:24 ` hubicka at gcc dot gnu.org
2023-08-15  9:23 ` cvs-commit at gcc dot gnu.org [this message]
2023-08-15  9:24 ` rguenth 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-110963-4-b4b1C8w87A@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).