aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgloop.cc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2023-07-21 13:38:29 +0200
committerJan Hubicka <jh@suse.cz>2023-07-21 13:39:25 +0200
commit15ec8d5ab5f21997cfa34cdba9f4b2daea40e710 (patch)
tree47a578c9bea25b09cd02d0dd4cb7286241ce515a /gcc/cfgloop.cc
parent1d96b11e4aef1727b3bd3215d0d8140a504d8eb7 (diff)
downloadgcc-15ec8d5ab5f21997cfa34cdba9f4b2daea40e710.zip
gcc-15ec8d5ab5f21997cfa34cdba9f4b2daea40e710.tar.gz
gcc-15ec8d5ab5f21997cfa34cdba9f4b2daea40e710.tar.bz2
improfe loop dumps
we have flow_loop_dump and print_loop. While print_loop was extended to dump stuff from loop structure we added over years (loop info), flow_loop_dump was not. -fdump-tree-all files contains flow_loop_dump which makes it hard to see what metadata we have attached to loop. This patch unifies dumping of these fields from both functions. For example for: int a[100]; main() { for (int i = 0; i < 10; i++) a[i]=i; } we now print: ;; Loop 0 ;; header 0, latch 1 ;; depth 0, outer -1 ;; nodes: 0 1 2 3 4 5 ;; ;; Loop 1 ;; header 4, latch 3 ;; depth 1, outer 0, finite_p ;; upper_bound 10 ;; likely_upper_bound 10 ;; estimate 10 ;; iterations by profile: 10.001101 (unreliable) finite_p, upper_boud, likely_upper_bound estimate and iterations by profile is new. Bootstrap/regtest on x86_64 in progress. OK if it passes? Honza gcc/ChangeLog: * cfgloop.cc (flow_loop_dump): Use print_loop_info. * cfgloop.h (print_loop_info): Declare. * tree-cfg.cc (print_loop_info): Break out from ...; add printing of missing fields and profile (print_loop): ... here. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/dce-1.c: Update for new loop dumps.
Diffstat (limited to 'gcc/cfgloop.cc')
-rw-r--r--gcc/cfgloop.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/gcc/cfgloop.cc b/gcc/cfgloop.cc
index 020e573..9ca85e6 100644
--- a/gcc/cfgloop.cc
+++ b/gcc/cfgloop.cc
@@ -135,17 +135,12 @@ flow_loop_dump (const class loop *loop, FILE *file,
fprintf (file, "\n");
}
- fprintf (file, ";; depth %d, outer %ld\n",
+ fprintf (file, ";; depth %d, outer %ld",
loop_depth (loop), (long) (loop_outer (loop)
? loop_outer (loop)->num : -1));
+ print_loop_info (file, loop, ";; ");
- bool reliable;
- sreal iterations;
- if (loop->num && expected_loop_iterations_by_profile (loop, &iterations, &reliable))
- fprintf (file, ";; profile-based iteration count: %f %s\n",
- iterations.to_double (), reliable ? "(reliable)" : "(unreliable)");
-
- fprintf (file, ";; nodes:");
+ fprintf (file, "\n;; nodes:");
bbs = get_loop_body (loop);
for (i = 0; i < loop->num_nodes; i++)
fprintf (file, " %d", bbs[i]->index);