public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/114301] New: gimple_can_duplicate_bb_p check for returns twice can be moved to the check of the last statement
@ 2024-03-10 22:29 pinskia at gcc dot gnu.org
  2024-03-10 22:29 ` [Bug tree-optimization/114301] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-10 22:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114301
           Summary: gimple_can_duplicate_bb_p check for returns twice can
                    be moved to the check of the last statement
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: compile-time-hog, internal-improvement
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: pinskia at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

It is the case that the returns twice function will always be the last
statement of the BB so the check for that can be moved up to the check of the
last statement part. This is a small optimization as gimple_call_flags (which
calls flags_from_decl_or_type) can call special_function_p and
special_function_p does string comparisons in the end. So removing as many
calls to gimple_call_flags  can speed up GCC slightly.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/114301] gimple_can_duplicate_bb_p check for returns twice can be moved to the check of the last statement
  2024-03-10 22:29 [Bug tree-optimization/114301] New: gimple_can_duplicate_bb_p check for returns twice can be moved to the check of the last statement pinskia at gcc dot gnu.org
@ 2024-03-10 22:29 ` pinskia at gcc dot gnu.org
  2024-05-14 15:53 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-10 22:29 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-03-10
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Noticed while looking PR 97333 .
Mine for GCC 15.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/114301] gimple_can_duplicate_bb_p check for returns twice can be moved to the check of the last statement
  2024-03-10 22:29 [Bug tree-optimization/114301] New: gimple_can_duplicate_bb_p check for returns twice can be moved to the check of the last statement pinskia at gcc dot gnu.org
  2024-03-10 22:29 ` [Bug tree-optimization/114301] " pinskia at gcc dot gnu.org
@ 2024-05-14 15:53 ` pinskia at gcc dot gnu.org
  2024-05-15  8:08 ` cvs-commit at gcc dot gnu.org
  2024-05-15  8:09 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-14 15:53 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2024-May/651
                   |                            |643.html
           Keywords|                            |patch

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch posted:
https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651643.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/114301] gimple_can_duplicate_bb_p check for returns twice can be moved to the check of the last statement
  2024-03-10 22:29 [Bug tree-optimization/114301] New: gimple_can_duplicate_bb_p check for returns twice can be moved to the check of the last statement pinskia at gcc dot gnu.org
  2024-03-10 22:29 ` [Bug tree-optimization/114301] " pinskia at gcc dot gnu.org
  2024-05-14 15:53 ` pinskia at gcc dot gnu.org
@ 2024-05-15  8:08 ` cvs-commit at gcc dot gnu.org
  2024-05-15  8:09 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-15  8:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:642f31d6286b8a342130fbface51530befd975fd

commit r15-501-g642f31d6286b8a342130fbface51530befd975fd
Author: Andrew Pinski <quic_apinski@quicinc.com>
Date:   Tue May 14 06:29:18 2024 -0700

    tree-cfg: Move the returns_twice check to be last statement only [PR114301]

    When I was checking to making sure that all of the bugs dealing
    with the case where gimple_can_duplicate_bb_p would return false was fixed,
    I noticed that the code which was checking if a call statement was
    returns_twice was checking all call statements rather than just the
    last statement. Since calling gimple_call_flags has a small non-zero
    overhead due to a few string comparison, removing the uses of it
    can have a small performance improvement. In the case of returns_twice
    functions calls, will always end the basic-block due to the check in
    stmt_can_terminate_bb_p (and others). So checking only the last statement
    is a small optimization and will be safe.

    Bootstrapped and tested pon x86_64-linux-gnu with no regressions.

            PR tree-optimization/114301
    gcc/ChangeLog:

            * tree-cfg.cc (gimple_can_duplicate_bb_p): Check returns_twice
            only on the last call statement rather than all.

    Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/114301] gimple_can_duplicate_bb_p check for returns twice can be moved to the check of the last statement
  2024-03-10 22:29 [Bug tree-optimization/114301] New: gimple_can_duplicate_bb_p check for returns twice can be moved to the check of the last statement pinskia at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-05-15  8:08 ` cvs-commit at gcc dot gnu.org
@ 2024-05-15  8:09 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-15  8:09 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |15.0
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-05-15  8:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-10 22:29 [Bug tree-optimization/114301] New: gimple_can_duplicate_bb_p check for returns twice can be moved to the check of the last statement pinskia at gcc dot gnu.org
2024-03-10 22:29 ` [Bug tree-optimization/114301] " pinskia at gcc dot gnu.org
2024-05-14 15:53 ` pinskia at gcc dot gnu.org
2024-05-15  8:08 ` cvs-commit at gcc dot gnu.org
2024-05-15  8:09 ` pinskia at gcc dot gnu.org

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).