summaryrefslogtreecommitdiff
path: root/gcc/loop-init.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/loop-init.c')
-rw-r--r--gcc/loop-init.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gcc/loop-init.c b/gcc/loop-init.c
index d64c110c1b5..b1954ca484f 100644
--- a/gcc/loop-init.c
+++ b/gcc/loop-init.c
@@ -99,6 +99,9 @@ loop_optimizer_init (unsigned flags)
#ifdef ENABLE_CHECKING
verify_loop_structure ();
#endif
+
+ /* Clear all flags. */
+ loops_state_clear (~0U);
}
/* Apply flags to loops. */
@@ -171,16 +174,19 @@ loop_fini_done:
the latch, and loops did not get new subloops (new loops might possibly
get created, but we are not interested in them). Fix up the mess.
- If CHANGED_BBS is not NULL, basic blocks whose loop has changed are
- marked in it. */
+ If CHANGED_BBS is not NULL, basic blocks whose loop depth has changed are
+ marked in it.
-void
+ Returns the number of new discovered loops. */
+
+unsigned
fix_loop_structure (bitmap changed_bbs)
{
basic_block bb;
int record_exits = 0;
loop_iterator li;
struct loop *loop;
+ unsigned old_nloops;
timevar_push (TV_LOOP_INIT);
@@ -228,6 +234,10 @@ fix_loop_structure (bitmap changed_bbs)
delete_loop (loop);
}
+ /* Remember the number of loops so we can return how many new loops
+ flow_loops_find discovered. */
+ old_nloops = number_of_loops ();
+
/* Re-compute loop structure in-place. */
flow_loops_find (current_loops);
@@ -253,6 +263,8 @@ fix_loop_structure (bitmap changed_bbs)
#endif
timevar_pop (TV_LOOP_INIT);
+
+ return number_of_loops () - old_nloops;
}
/* Gate for the RTL loop superpass. The actual passes are subpasses.