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 <hubi...@gcc.gnu.org>:

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

commit r14-2228-g02460c0b8c9000359a09440f9532664a7835f158
Author: Jan Hubicka <j...@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.

Reply via email to