diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b4e12f3646f..cbd6f4b0e61 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2003-12-27 Zdenek Dvorak + + PR opt/13159 + * cfgloopanal.c (mark_irreducible_loops): Fix the strongly connected + components detection. + * loop-unswitch.c (unswitch_loop): Preserve simple preheaders. + 2003-12-27 Bernardo Innocenti * config/m68k/uclinux.h (LIB_SPEC): Add elf2flt magic required for diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c index 3d6e69ef48d..74cebe00919 100644 --- a/gcc/cfgloopanal.c +++ b/gcc/cfgloopanal.c @@ -1247,7 +1247,7 @@ mark_irreducible_loops (struct loops *loops) : e->dest->index + 1; if (closed[sidx]) { - if (!closed[mri[sidx]]) + if (mri[sidx] != -1 && !closed[mri[sidx]]) { if (mr[sidx] < mr[idx]) { diff --git a/gcc/loop-unswitch.c b/gcc/loop-unswitch.c index f276b7307a4..25728c2bf62 100644 --- a/gcc/loop-unswitch.c +++ b/gcc/loop-unswitch.c @@ -402,5 +402,9 @@ unswitch_loop (struct loops *loops, struct loop *loop, basic_block unswitch_on) fix_loop_placement (loop); fix_loop_placement (nloop); + /* Preserve the simple loop preheaders. */ + loop_split_edge_with (loop_preheader_edge (loop), NULL_RTX, loops); + loop_split_edge_with (loop_preheader_edge (nloop), NULL_RTX, loops); + return nloop; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e0086f471e9..b124d130981 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2003-12-27 Zdenek Dvorak + + * gcc.c-torture/compile/20031227-1.c: New test. + 2003-12-23 Mark Mitchell * g++.dg/bprob/bprob.exp: Load target-supports.exp diff --git a/gcc/testsuite/gcc.c-torture/compile/20031227-1.c b/gcc/testsuite/gcc.c-torture/compile/20031227-1.c new file mode 100644 index 00000000000..41597bd18e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031227-1.c @@ -0,0 +1,17 @@ +/* PR opt/13159 -- test unswitching a loop multiple times. */ + +void +foo (void) +{ + long j, k, p, g; + + while (p) + { + while (k < 0 && j < 0) + ; + if (g) + ; + else if (g) + ; + } +}