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/103680] Jump threading and switch corrupts profile
Date: Sat, 01 Jul 2023 07:11:32 +0000	[thread overview]
Message-ID: <bug-103680-4-nCl618Iraz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103680-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jan Hubicka <hubicka@gcc.gnu.org>:

https://gcc.gnu.org/g:02460c0b8c9000359a09440f9532664a7835f158

commit r14-2228-g02460c0b8c9000359a09440f9532664a7835f158
Author: Jan Hubicka <jh@suse.cz>
Date:   Sat Jul 1 09:09:39 2023 +0200

    Fix update_bb_profile_for_threading

    Fix profile some of profile mismatched caused by profile updating.
    It seems that I misupdated update_bb_profile_for_threading in 2017 which
    results in invalid updates from rtl threading and threadbackwards.
    update_bb_profile_for_threading knows that some paths to BB are being
    redirected elsehwere and those paths will exit from BB with E.  So it needs
to
    determine probability of the duplicated path and redistribute probablities.
    For some reaosn however the conditonal probability of redirected path is
    computed after its counts is subtracted which is wrong and often results in
    probability greater than 100%.

    I also fixed error mesage.  Compilling tramp3d I now get following passes
    producing mismpatches:
    Pass dump id and name            |static mismatcdynamic mismatch
                                     |in count     |in count
    113t fre                         |      2    +2|            0
    114t mergephi                    |      2      |            0
    115t threadfull                  |      2      |            0
    116t vrp                         |      2      |            0
    127t ch                          |    307  +305|    347194302   +347194302
    130t thread                      |    313    +6|    347221478       +27176
    131t dom                         |    321    +8|    346841121      -380357
    134t reassoc                     |    323    +2|    346841121
    136t forwprop                    |    327    +4|    347026371      +185250
    144t pre                         |    326    -1|    347040926       +14555
    172t ifcvt                       |    338    +2|    347218249      +156280
    173t vect                        |    409   +71|    356357418     +9139169
    176t cunroll                     |    377   -32|    126071925   -230285493
    183t loopdone                    |    376    -1|    126015489       -56436
    194t tracer                      |    379    +3|    127258199     +1242710
    197t dom                         |    375    -4|    128352165     +1093966
    199t threadfull                  |    379    +4|    128526112      +173947
    200t vrp                         |    381    +2|    128724673      +198561
    204t dce                         |    374    -7|    128632495       -92178
    206t sink                        |    370    -4|    128618043       -14452
    211t cddce                       |    372    +2|    128632495       +14452
    248t ehcleanup                   |    370    -2|    128618755       -13740
    255t optimized                   |    362    -8|    128576810       -41945
    256r expand                      |    356    -6|    128899768      +322958
    258r into_cfglayout              |    353    -3|    129051765      +151997
    259r jump                        |    354    +1|    129051765
    262r cse1                        |    353    -1|    129051765
    275r loop2_unroll                |    355    +2|    132182110     +3130345
    277r loop2_done                  |    354    -1|    132182109           -1
    312r pro_and_epilogue            |    371   +17|    132222324       +40215
    323r bbro                        |    375    +4|    132095926      -126398

    Without the patch at jump2 time we get over 432 mismatches, so 15%
    improvement. Some of the mismathces are unavoidable.

    I think ch mismatches are mostly due to loop header copying where the
header
    condition constant propagates.  Most common case should be threadable in
early
    optimizations and we also could do better on profile updating here.

    Bootstrapped/regtested x6_64-linux, comitted.

    gcc/ChangeLog:

            PR tree-optimization/103680
            * cfg.cc (update_bb_profile_for_threading): Fix profile update;
            make message clearer.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/103680
            * gcc.dg/tree-ssa/pr103680.c: New test.
            * gcc.dg/tree-prof/cmpsf-1.c: Un-xfail.

      parent reply	other threads:[~2023-07-01  7:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13 10:51 [Bug tree-optimization/103680] New: " hubicka at gcc dot gnu.org
2021-12-13 10:55 ` [Bug tree-optimization/103680] " hubicka at gcc dot gnu.org
2021-12-13 12:26 ` marxin at gcc dot gnu.org
2021-12-13 13:56 ` pinskia at gcc dot gnu.org
2022-01-04  9:54 ` rguenth at gcc dot gnu.org
2022-04-09 21:27 ` hubicka at gcc dot gnu.org
2022-11-30 13:04 ` cvs-commit at gcc dot gnu.org
2023-06-28  9:16 ` hubicka at gcc dot gnu.org
2023-06-28 16:47 ` pinskia at gcc dot gnu.org
2023-06-28 21:30 ` hubicka at gcc dot gnu.org
2023-06-30 16:18 ` hubicka at gcc dot gnu.org
2023-06-30 16:22 ` hubicka at gcc dot gnu.org
2023-07-01  7:11 ` cvs-commit at gcc dot gnu.org [this message]

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-103680-4-nCl618Iraz@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).