diff options
author | Jan Hubicka <jh@suse.cz> | 2023-07-27 16:17:59 +0200 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2023-07-27 16:17:59 +0200 |
commit | 9bd1ee6d330b0441c165d889b6b25a5c85caf427 (patch) | |
tree | 15cb87291139c31b3212fde280ce99ee5a0b496d /gcc/cfgloopmanip.h | |
parent | 5b06b3b8771d0dc06426986be32b8599e97bb451 (diff) | |
download | gcc-9bd1ee6d330b0441c165d889b6b25a5c85caf427.zip gcc-9bd1ee6d330b0441c165d889b6b25a5c85caf427.tar.gz gcc-9bd1ee6d330b0441c165d889b6b25a5c85caf427.tar.bz2 |
Fix profile update in tree_transform_and_unroll_loop
Fixe profile update in tree_transform_and_unroll_loop which is used
by predictive comming. I stared by attempt to fix
gcc.dg/tree-ssa/update-unroll-1.c I xfailed last week, but it turned to be
harder job.
Unrolling was never fixed for changes in duplicate_loop_body_to_header_edge
which is now smarter on getting profile right when some exists are eliminated.
A lot of manual profile can thus now be done using existing infrastructure.
I also noticed that scale_dominated_blocks_in_loop does job identical
to loop I wrote in scale_loop_profile and thus I commonized the implementaiton
and removed recursion.
I also extended duplicate_loop_body_to_header_edge to handle flat profiles same
way as we do in vectorizer. Without it we end up with less then 0 iteration
count in gcc.dg/tree-ssa/update-unroll-1.c (it is unrolled 32times but predicted
to iterated fewer times) and added missing code to update loop_info.
gcc/ChangeLog:
* cfgloopmanip.cc (scale_dominated_blocks_in_loop): Move here from
tree-ssa-loop-manip.cc and avoid recursion.
(scale_loop_profile): Use scale_dominated_blocks_in_loop.
(duplicate_loop_body_to_header_edge): Add DLTHE_FLAG_FLAT_PROFILE
flag.
* cfgloopmanip.h (DLTHE_FLAG_FLAT_PROFILE): Define.
(scale_dominated_blocks_in_loop): Declare.
* predict.cc (dump_prediction): Do not ICE on uninitialized probability.
(change_edge_frequency): Remove.
* predict.h (change_edge_frequency): Remove.
* tree-ssa-loop-manip.cc (scale_dominated_blocks_in_loop): Move to
cfgloopmanip.cc.
(niter_for_unrolled_loop): Remove.
(tree_transform_and_unroll_loop): Fix profile update.
gcc/testsuite/ChangeLog:
* gcc.dg/pr102385.c: Check for no profile mismatches.
* gcc.dg/pr96931.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-1.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-2.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-3.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-4.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-5.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-7.c: Check for one profile mismatch.
* gcc.dg/tree-ssa/predcom-8.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-dse-1.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-dse-10.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-dse-11.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-dse-12.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-dse-2.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-dse-3.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-dse-4.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-dse-5.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-dse-6.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-dse-7.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-dse-8.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/predcom-dse-9.c: Check for no profile mismatches.
* gcc.dg/tree-ssa/update-unroll-1.c: Unxfail.
Diffstat (limited to 'gcc/cfgloopmanip.h')
-rw-r--r-- | gcc/cfgloopmanip.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/cfgloopmanip.h b/gcc/cfgloopmanip.h index 75b2a5e..af6a29f 100644 --- a/gcc/cfgloopmanip.h +++ b/gcc/cfgloopmanip.h @@ -32,6 +32,8 @@ enum field of newly create BB. */ #define DLTHE_FLAG_COMPLETTE_PEEL 4 /* Update frequencies expecting a complete peeling. */ +#define DLTHE_FLAG_FLAT_PROFILE 8 /* Profile is flat; do not reduce + count by unroll factor. */ extern edge mfb_kj_edge; extern bool remove_path (edge, bool * = NULL, bitmap = NULL); @@ -64,5 +66,7 @@ class loop * loop_version (class loop *, void *, profile_probability, profile_probability, profile_probability, profile_probability, bool); void adjust_loop_info_after_peeling (class loop *loop, int npeel, bool precise); +void scale_dominated_blocks_in_loop (class loop *loop, basic_block bb, + profile_count num, profile_count den); #endif /* GCC_CFGLOOPMANIP_H */ |