diff options
author | Jan Hubicka <jh@suse.cz> | 2023-07-21 17:34:31 +0200 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2023-07-21 17:34:31 +0200 |
commit | ea272814c23d2b88dc846b225c041594ae6be3e3 (patch) | |
tree | e59541c8aa7fd3a0a96692c626cc2bfe037aac88 /gcc/tree-cfg.cc | |
parent | 3291f9e6cba2ea6a170ba4fc7ddbb57218d3f9f6 (diff) | |
download | gcc-ea272814c23d2b88dc846b225c041594ae6be3e3.zip gcc-ea272814c23d2b88dc846b225c041594ae6be3e3.tar.gz gcc-ea272814c23d2b88dc846b225c041594ae6be3e3.tar.bz2 |
Implement flat loop profile detection
This patch adds maybe_flat_loop_profile which can be used in loop profile udpate
to detect situation where the profile may be unrealistically flat and should
not be dwonscalled after vectorizing, unrolling and other transforms that
assume that loop has high iteration count even if the CFG profile says
otherwise.
Profile is flat if it was statically detected and at that time we had
no idea about actual number of iterations or we artificially capped them.
So the function considers flat all profiles that have guessed or lower
reliability in their count and there is no nb_iteration_bounds/estimate
which would prove that the profile iteration count is high enough.
gcc/ChangeLog:
* cfgloop.h (maybe_flat_loop_profile): Declare
* cfgloopanal.cc (maybe_flat_loop_profile): New function.
* tree-cfg.cc (print_loop_info): Print info about flat profiles.
Diffstat (limited to 'gcc/tree-cfg.cc')
-rw-r--r-- | gcc/tree-cfg.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc index a6c97a0..c65af8c 100644 --- a/gcc/tree-cfg.cc +++ b/gcc/tree-cfg.cc @@ -8523,8 +8523,11 @@ print_loop_info (FILE *file, const class loop *loop, const char *prefix) bool reliable; sreal iterations; if (loop->num && expected_loop_iterations_by_profile (loop, &iterations, &reliable)) - fprintf (file, "\n%siterations by profile: %f %s", prefix, - iterations.to_double (), reliable ? "(reliable)" : "(unreliable)"); + { + fprintf (file, "\n%siterations by profile: %f (%s%s)", prefix, + iterations.to_double (), reliable ? "reliable" : "unreliable", + maybe_flat_loop_profile (loop) ? ", maybe flat" : ""); + } } |