summaryrefslogtreecommitdiff
path: root/gcc/cfgloopmanip.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2004-04-23 22:01:35 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2004-04-23 22:01:35 +0000
commit82233aadd996c9e2144cae56d940076cea1d0e54 (patch)
tree23910f8a83c06830e31193db62701766afc5624d /gcc/cfgloopmanip.c
parent4748171af0a3b161a4e1688b4ee1d2ab14fdc6ef (diff)
downloadgcc-82233aadd996c9e2144cae56d940076cea1d0e54.tar.gz
PR optimization/13985
* cfgloopmanip.c (fix_loop_placements): New prototype. Call fix_bb_placements on the preheader of loops that have been reparented. (remove_path): Adjust call to fix_loop_placements. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81112 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgloopmanip.c')
-rw-r--r--gcc/cfgloopmanip.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 59ae4a1ed7a..e3807801d23 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -41,7 +41,7 @@ static bool rpe_enum_p (basic_block, void *);
static int find_path (edge, basic_block **);
static bool alp_enum_p (basic_block, void *);
static void add_loop (struct loops *, struct loop *);
-static void fix_loop_placements (struct loop *);
+static void fix_loop_placements (struct loops *, struct loop *);
static bool fix_bb_placement (struct loops *, basic_block);
static void fix_bb_placements (struct loops *, basic_block);
static void place_new_loop (struct loops *, struct loop *);
@@ -413,7 +413,7 @@ remove_path (struct loops *loops, edge e)
/* Fix placements of basic blocks inside loops and the placement of
loops in the loop tree. */
fix_bb_placements (loops, from);
- fix_loop_placements (from->loop_father);
+ fix_loop_placements (loops, from->loop_father);
return true;
}
@@ -668,7 +668,7 @@ fix_loop_placement (struct loop *loop)
It is used in case when we removed some edges coming out of LOOP, which
may cause the right placement of LOOP inside loop tree to change. */
static void
-fix_loop_placements (struct loop *loop)
+fix_loop_placements (struct loops *loops, struct loop *loop)
{
struct loop *outer;
@@ -677,6 +677,13 @@ fix_loop_placements (struct loop *loop)
outer = loop->outer;
if (!fix_loop_placement (loop))
break;
+
+ /* Changing the placement of a loop in the loop tree may alter the
+ validity of condition 2) of the description of fix_bb_placement
+ for its preheader, because the successor is the header and belongs
+ to the loop. So call fix_bb_placements to fix up the placement
+ of the preheader and (possibly) of its predecessors. */
+ fix_bb_placements (loops, loop_preheader_edge (loop)->src);
loop = outer;
}
}