summaryrefslogtreecommitdiff
path: root/gcc/cfgloopmanip.c
diff options
context:
space:
mode:
authorMarek Polacek <mpolacek@gcc.gnu.org>2013-01-17 19:19:37 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2013-01-17 19:19:37 +0000
commit1bd3f7500b7223cded3ae19ff27eb27e05a9b147 (patch)
tree3822c20e0748ca647e4e66ae8d810fb118d5e225 /gcc/cfgloopmanip.c
parent7b045477e28e324070ea503d3ce1561ba774ee01 (diff)
downloadgcc-1bd3f7500b7223cded3ae19ff27eb27e05a9b147.tar.gz
Fix PR55833.
From-SVN: r195280
Diffstat (limited to 'gcc/cfgloopmanip.c')
-rw-r--r--gcc/cfgloopmanip.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 487560734fa..8c6c39de86b 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -111,10 +111,13 @@ fix_bb_placement (basic_block bb)
/* Fix placement of LOOP inside loop tree, i.e. find the innermost superloop
of LOOP to that leads at least one exit edge of LOOP, and set it
as the immediate superloop of LOOP. Return true if the immediate superloop
- of LOOP changed. */
+ of LOOP changed.
+
+ IRRED_INVALIDATED is set to true if a change in the loop structures might
+ invalidate the information about irreducible regions. */
static bool
-fix_loop_placement (struct loop *loop)
+fix_loop_placement (struct loop *loop, bool *irred_invalidated)
{
unsigned i;
edge e;
@@ -139,7 +142,12 @@ fix_loop_placement (struct loop *loop)
/* The exit edges of LOOP no longer exits its original immediate
superloops; remove them from the appropriate exit lists. */
FOR_EACH_VEC_ELT (exits, i, e)
- rescan_loop_exit (e, false, false);
+ {
+ /* We may need to recompute irreducible loops. */
+ if (e->flags & EDGE_IRREDUCIBLE_LOOP)
+ *irred_invalidated = true;
+ rescan_loop_exit (e, false, false);
+ }
ret = true;
}
@@ -212,7 +220,7 @@ fix_bb_placements (basic_block from,
if (from->loop_father->header == from)
{
/* Subloop header, maybe move the loop upward. */
- if (!fix_loop_placement (from->loop_father))
+ if (!fix_loop_placement (from->loop_father, irred_invalidated))
continue;
target_loop = loop_outer (from->loop_father);
}
@@ -965,7 +973,7 @@ fix_loop_placements (struct loop *loop, bool *irred_invalidated)
while (loop_outer (loop))
{
outer = loop_outer (loop);
- if (!fix_loop_placement (loop))
+ if (!fix_loop_placement (loop, irred_invalidated))
break;
/* Changing the placement of a loop in the loop tree may alter the