This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[cfg-branch] unroll-new cleanups
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-pdo at atrey dot karlin dot mff dot cuni dot cz,Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>,gcc-patches at gcc dot gnu dot org
- Date: Mon, 29 Apr 2002 13:34:01 +0200
- Subject: [cfg-branch] unroll-new cleanups
Zdenek,
I've made pass trought unroll-new.c and fixed some problems. I've converted
all niters to unsigned HOST_WIDE_INT, so I hope it will elliminate the
overflows bugging us from time to time. I've also converted return values
to bools and did some similar changes.
Can you please check the patch? I've removed some code handling overflows
on niter in hope it is no longer needed as we always fit to unsigned type.
Mon Apr 29 13:30:34 CEST 2002 Jan Hubicka <jh@suse.cz>
* unroll-new.c: Some formating fixes; fix types.
Index: unroll-new.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/Attic/unroll-new.c,v
retrieving revision 1.1.2.14
diff -c -3 -p -r1.1.2.14 unroll-new.c
*** unroll-new.c 26 Apr 2002 07:35:08 -0000 1.1.2.14
--- unroll-new.c 29 Apr 2002 11:28:48 -0000
*************** Software Foundation, 59 Temple Place - S
*** 42,59 ****
#include "params.h"
#include "output.h"
! static basic_block simple_exit PARAMS ((struct loops *, struct loop *, basic_block *, int *));
! static bool simple_condition_p PARAMS ((struct loop *, basic_block *, rtx, struct loop_desc *));
! static basic_block simple_increment PARAMS ((struct loops *, struct loop *, basic_block *, struct loop_desc *));
static rtx variable_initial_value PARAMS ((struct loop *, rtx));
! static bool simple_loop_p PARAMS ((struct loops *, struct loop *, struct loop_desc *));
! static int count_loop_iterations PARAMS ((struct loop_desc *, HOST_WIDE_INT *, rtx *));
! static int unroll_or_peel_loop PARAMS ((struct loops *, struct loop *, int));
! static int peel_loop_simple PARAMS ((struct loops *, struct loop *, int));
! static int peel_loop_completely PARAMS ((struct loops *, struct loop *, struct loop_desc *));
! static int unroll_loop_stupid PARAMS ((struct loops *, struct loop *, int));
! static int unroll_loop_constant_iterations PARAMS ((struct loops *, struct loop *, int, struct loop_desc *));
! static int unroll_loop_runtime_iterations PARAMS ((struct loops *, struct loop *, int, struct loop_desc *));
/* Unroll and peel (depending on FLAGS) LOOPS. */
void
--- 42,70 ----
#include "params.h"
#include "output.h"
! static basic_block simple_exit PARAMS ((struct loops *, struct loop *,
! basic_block *, int *));
! static bool simple_condition_p PARAMS ((struct loop *, basic_block *,
! rtx, struct loop_desc *));
! static basic_block simple_increment PARAMS ((struct loops *, struct loop *,
! basic_block *,
! struct loop_desc *));
static rtx variable_initial_value PARAMS ((struct loop *, rtx));
! static bool simple_loop_p PARAMS ((struct loops *, struct loop *,
! struct loop_desc *));
! static bool count_loop_iterations PARAMS ((struct loop_desc *,
! unsigned HOST_WIDE_INT *, rtx *));
! static void unroll_or_peel_loop PARAMS ((struct loops *, struct loop *, int));
! static bool peel_loop_simple PARAMS ((struct loops *, struct loop *, int));
! static bool peel_loop_completely PARAMS ((struct loops *, struct loop *,
! struct loop_desc *));
! static bool unroll_loop_stupid PARAMS ((struct loops *, struct loop *, int));
! static bool unroll_loop_constant_iterations PARAMS ((struct loops *,
! struct loop *,
! int, struct loop_desc *));
! static bool unroll_loop_runtime_iterations PARAMS ((struct loops *,
! struct loop *, int,
! struct loop_desc *));
/* Unroll and peel (depending on FLAGS) LOOPS. */
void
*************** simple_loop_p (loops, loop, desc)
*** 397,411 ****
return false;
}
! /* Counts number of iterations described by DESC or emits sequence to count it. */
! static int
count_loop_iterations (desc, niter, rniter)
struct loop_desc *desc;
! HOST_WIDE_INT *niter;
rtx *rniter;
{
int delta;
! HOST_WIDE_INT abs_diff = 0;
enum rtx_code cond = desc->cond;
if (desc->grow)
--- 408,424 ----
return false;
}
! /* Counts number of iterations described by DESC and store it into NITER
! or emit sequence to count it at runtime and store to register RNITER.
! Return true if it is possible to determine number of iterations. */
! static bool
count_loop_iterations (desc, niter, rniter)
struct loop_desc *desc;
! unsigned HOST_WIDE_INT *niter;
rtx *rniter;
{
int delta;
! unsigned HOST_WIDE_INT abs_diff = 0;
enum rtx_code cond = desc->cond;
if (desc->grow)
*************** count_loop_iterations (desc, niter, rnit
*** 425,431 ****
{
cond = swap_condition (cond);
if (cond == UNKNOWN)
! return 0;
if (rniter)
*rniter = expand_simple_binop (GET_MODE (desc->var), MINUS,
--- 438,444 ----
{
cond = swap_condition (cond);
if (cond == UNKNOWN)
! return false;
if (rniter)
*rniter = expand_simple_binop (GET_MODE (desc->var), MINUS,
*************** count_loop_iterations (desc, niter, rnit
*** 449,455 ****
{
cond = reverse_condition (cond);
if (cond == UNKNOWN)
! return 0;
}
delta = 0;
--- 462,468 ----
{
cond = reverse_condition (cond);
if (cond == UNKNOWN)
! return false;
}
delta = 0;
*************** count_loop_iterations (desc, niter, rnit
*** 469,475 ****
case EQ:
/* These cases are a bit strange. Better not to play with
something I don't understand. */
! return 0;
default:
abort ();
}
--- 482,488 ----
case EQ:
/* These cases are a bit strange. Better not to play with
something I don't understand. */
! return false;
default:
abort ();
}
*************** count_loop_iterations (desc, niter, rnit
*** 478,484 ****
{
*niter = abs_diff + delta;
if (rtl_dump_file)
! fprintf (rtl_dump_file, "; Number of iterations: %i\n", *niter);
}
if (rniter && delta)
--- 491,497 ----
{
*niter = abs_diff + delta;
if (rtl_dump_file)
! fprintf (rtl_dump_file, "; Number of iterations: %i\n", (int) *niter);
}
if (rniter && delta)
*************** count_loop_iterations (desc, niter, rnit
*** 487,505 ****
GEN_INT (delta),
NULL_RTX, 0, OPTAB_LIB_WIDEN);
! return 1;
}
/* Peel NPEEL iterations from LOOP, remove exit edges (and cancel the loop
completely). */
! static int
peel_loop_completely (loops, loop, desc)
struct loops *loops;
struct loop *loop;
struct loop_desc *desc;
{
sbitmap wont_exit;
! HOST_WIDE_INT npeel;
if (!count_loop_iterations (desc, &npeel, NULL))
abort (); /* Tested already. */
--- 500,518 ----
GEN_INT (delta),
NULL_RTX, 0, OPTAB_LIB_WIDEN);
! return true;
}
/* Peel NPEEL iterations from LOOP, remove exit edges (and cancel the loop
completely). */
! static bool
peel_loop_completely (loops, loop, desc)
struct loops *loops;
struct loop *loop;
struct loop_desc *desc;
{
sbitmap wont_exit;
! unsigned HOST_WIDE_INT npeel;
if (!count_loop_iterations (desc, &npeel, NULL))
abort (); /* Tested already. */
*************** peel_loop_completely (loops, loop, desc)
*** 517,556 ****
if (rtl_dump_file)
fprintf (rtl_dump_file, ";; Peeled loop completely, %d times\n",npeel);
! return 1;
}
/* Unroll LOOP with constant number of iterations described by DESC.
MAX_UNROLL is maximal number of allowed unrollings. */
! static int
unroll_loop_constant_iterations (loops, loop, max_unroll, desc)
struct loops *loops;
struct loop *loop;
int max_unroll;
struct loop_desc *desc;
{
! HOST_WIDE_INT niter, exit_mod;
sbitmap wont_exit;
/* Normalization. */
if (!count_loop_iterations (desc, &niter, NULL))
abort (); /* Tested already. */
! if (niter < 0)
! {
! if (desc->cond == NE)
! {
! int i;
! /* We must count with overflow. */
! for (i = 1; 2 * i <= max_unroll + 1; i *= 2);
! max_unroll = i - 1;
! niter = niter % i + 256;
! }
! else
! abort (); /* Should not get here. */
! }
!
! if (niter <= max_unroll)
abort (); /* Should get into peeling instead. */
wont_exit = sbitmap_alloc (max_unroll + 1);
--- 530,555 ----
if (rtl_dump_file)
fprintf (rtl_dump_file, ";; Peeled loop completely, %d times\n",npeel);
! return true;
}
/* Unroll LOOP with constant number of iterations described by DESC.
MAX_UNROLL is maximal number of allowed unrollings. */
! static bool
unroll_loop_constant_iterations (loops, loop, max_unroll, desc)
struct loops *loops;
struct loop *loop;
int max_unroll;
struct loop_desc *desc;
{
! unsigned HOST_WIDE_INT niter, exit_mod;
sbitmap wont_exit;
/* Normalization. */
if (!count_loop_iterations (desc, &niter, NULL))
abort (); /* Tested already. */
! if (niter <= (unsigned) max_unroll)
abort (); /* Should get into peeling instead. */
wont_exit = sbitmap_alloc (max_unroll + 1);
*************** unroll_loop_constant_iterations (loops,
*** 584,590 ****
case when we would exit before reaching the loop. So just peel
exit_mod + 1 iterations.
*/
! if (exit_mod != max_unroll)
{
RESET_BIT (wont_exit, 0);
--- 583,589 ----
case when we would exit before reaching the loop. So just peel
exit_mod + 1 iterations.
*/
! if (exit_mod != (unsigned) max_unroll)
{
RESET_BIT (wont_exit, 0);
*************** unroll_loop_constant_iterations (loops,
*** 607,618 ****
if (rtl_dump_file)
fprintf (rtl_dump_file, ";; Unrolled loop %d times, constant # of iterations\n",max_unroll);
! return 1;
}
/* Unroll LOOP for that we are able to count number of iterations in runtime.
MAX_UNROLL is maximal number of allowed unrollings. DESC describes the loop. */
! static int
unroll_loop_runtime_iterations (loops, loop, max_unroll, desc)
struct loops *loops;
struct loop *loop;
--- 606,617 ----
if (rtl_dump_file)
fprintf (rtl_dump_file, ";; Unrolled loop %d times, constant # of iterations\n",max_unroll);
! return true;
}
/* Unroll LOOP for that we are able to count number of iterations in runtime.
MAX_UNROLL is maximal number of allowed unrollings. DESC describes the loop. */
! static bool
unroll_loop_runtime_iterations (loops, loop, max_unroll, desc)
struct loops *loops;
struct loop *loop;
*************** unroll_loop_runtime_iterations (loops, l
*** 634,646 ****
/* Normalization. */
start_sequence ();
if (!count_loop_iterations (desc, NULL, &niter))
! abort (); /* Tested already. */
/* Count modulo by ANDing it with max_unroll. */
niter = expand_simple_binop (GET_MODE (desc->var), AND,
! niter,
! GEN_INT (max_unroll),
! NULL_RTX, 0, OPTAB_LIB_WIDEN);
if (desc->postincr)
{
--- 633,645 ----
/* Normalization. */
start_sequence ();
if (!count_loop_iterations (desc, NULL, &niter))
! abort (); /* Tested already. */
/* Count modulo by ANDing it with max_unroll. */
niter = expand_simple_binop (GET_MODE (desc->var), AND,
! niter,
! GEN_INT (max_unroll),
! NULL_RTX, 0, OPTAB_LIB_WIDEN);
if (desc->postincr)
{
*************** unroll_loop_runtime_iterations (loops, l
*** 653,672 ****
/* Leave exit in last copy. */
may_exit_copy = max_unroll;
niter = expand_simple_binop (GET_MODE (desc->var), PLUS,
! niter,
! const1_rtx,
! NULL_RTX, 0, OPTAB_LIB_WIDEN);
n_peel = max_unroll + 1;
/* First check for zero is obviously unnecessary now; it might seem
! we could do better by increasing it before AND; but we must have
! guaranteed that exit condition will be checked in first iteration,
! so that we won't miscompile loop with negative number of iterations. */
}
niter = expand_simple_binop (GET_MODE (desc->var), PLUS,
! niter,
! const1_rtx,
! NULL_RTX, 0, OPTAB_LIB_WIDEN);
init_code = gen_sequence ();
end_sequence ();
--- 652,669 ----
/* Leave exit in last copy. */
may_exit_copy = max_unroll;
niter = expand_simple_binop (GET_MODE (desc->var), PLUS,
! niter,
! const1_rtx, NULL_RTX, 0, OPTAB_LIB_WIDEN);
n_peel = max_unroll + 1;
/* First check for zero is obviously unnecessary now; it might seem
! we could do better by increasing it before AND; but we must have
! guaranteed that exit condition will be checked in first iteration,
! so that we won't miscompile loop with negative number of iterations. */
}
niter = expand_simple_binop (GET_MODE (desc->var), PLUS,
! niter,
! const1_rtx, NULL_RTX, 0, OPTAB_LIB_WIDEN);
init_code = gen_sequence ();
end_sequence ();
*************** unroll_loop_runtime_iterations (loops, l
*** 682,716 ****
{
start_sequence ();
niter = expand_simple_binop (GET_MODE (desc->var), MINUS,
! niter, const1_rtx,
! NULL_RTX, 0, OPTAB_LIB_WIDEN);
! do_compare_rtx_and_jump (copy_rtx (niter), const0_rtx, EQ, 0, GET_MODE (desc->var),
! NULL_RTX, NULL_RTX, loop_beg_label);
JUMP_LABEL (get_last_insn ()) = loop_beg_label;
LABEL_NUSES (loop_beg_label)++;
branch_code = gen_sequence ();
end_sequence ();
! preheader = loop_split_edge_with (loop_preheader_edge (loop), branch_code, loops);
make_edge (preheader, fake, 0);
wont_exit = sbitmap_alloc (2);
sbitmap_zero (wont_exit);
/* We must be a bit careful here, as we might have negative
! number of iterations. Also, in case of postincrement we do
! not know whether we should not exit before reaching the loop. */
! if (desc->postincr
! && (i || desc->cond == NE))
! SET_BIT (wont_exit, 1);
if (!duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop),
! loops, 1, wont_exit, DLTHE_FLAG_ALL))
! abort ();
free (wont_exit);
}
/* Now redirect the edges from fake. */
! preheader = loop_split_edge_with (loop_preheader_edge (loop), NULL_RTX, loops);
loop_beg_label = block_label (preheader);
for (e = fake->pred; e; e = fake->pred)
--- 679,716 ----
{
start_sequence ();
niter = expand_simple_binop (GET_MODE (desc->var), MINUS,
! niter, const1_rtx,
! NULL_RTX, 0, OPTAB_LIB_WIDEN);
! do_compare_rtx_and_jump (copy_rtx (niter), const0_rtx, EQ, 0,
! GET_MODE (desc->var), NULL_RTX, NULL_RTX,
! loop_beg_label);
JUMP_LABEL (get_last_insn ()) = loop_beg_label;
LABEL_NUSES (loop_beg_label)++;
branch_code = gen_sequence ();
end_sequence ();
! preheader =
! loop_split_edge_with (loop_preheader_edge (loop), branch_code, loops);
make_edge (preheader, fake, 0);
wont_exit = sbitmap_alloc (2);
sbitmap_zero (wont_exit);
/* We must be a bit careful here, as we might have negative
! number of iterations. Also, in case of postincrement we do
! not know whether we should not exit before reaching the loop. */
! if (desc->postincr && (i || desc->cond == NE))
! SET_BIT (wont_exit, 1);
if (!duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop),
! loops, 1, wont_exit,
! DLTHE_FLAG_ALL))
! abort ();
free (wont_exit);
}
/* Now redirect the edges from fake. */
! preheader =
! loop_split_edge_with (loop_preheader_edge (loop), NULL_RTX, loops);
loop_beg_label = block_label (preheader);
for (e = fake->pred; e; e = fake->pred)
*************** unroll_loop_runtime_iterations (loops, l
*** 732,738 ****
if (flow_bb_inside_loop_p (loop, e->dest))
continue;
set_immediate_dominator (loops->cfg.dom, e->dest,
! nearest_common_dominator (loops->cfg.dom, e->dest, dom));
}
free (body);
}
--- 732,739 ----
if (flow_bb_inside_loop_p (loop, e->dest))
continue;
set_immediate_dominator (loops->cfg.dom, e->dest,
! nearest_common_dominator (loops->cfg.dom,
! e->dest, dom));
}
free (body);
}
*************** unroll_loop_runtime_iterations (loops, l
*** 747,764 ****
RESET_BIT (wont_exit, may_exit_copy);
if (!duplicate_loop_to_header_edge (loop, loop_latch_edge (loop),
! loops, max_unroll, wont_exit, DLTHE_FLAG_ALL))
abort ();
free (wont_exit);
if (rtl_dump_file)
! fprintf (rtl_dump_file, ";; Unrolled loop %d times, counting # of iterations in runtime\n", max_unroll);
!
! return 1;
! }
/* Peel a LOOP. Returs 0 if impossible, 1 otherwise. */
! static int
peel_loop_simple (loops, loop, npeel)
struct loops *loops;
struct loop *loop;
--- 748,768 ----
RESET_BIT (wont_exit, may_exit_copy);
if (!duplicate_loop_to_header_edge (loop, loop_latch_edge (loop),
! loops, max_unroll, wont_exit,
! DLTHE_FLAG_ALL))
abort ();
free (wont_exit);
if (rtl_dump_file)
! fprintf (rtl_dump_file,
! ";; Unrolled loop %d times, counting # of iterations in runtime\n",
! max_unroll);
!
! return true;
! }
/* Peel a LOOP. Returs 0 if impossible, 1 otherwise. */
! static bool
peel_loop_simple (loops, loop, npeel)
struct loops *loops;
struct loop *loop;
*************** peel_loop_simple (loops, loop, npeel)
*** 774,780 ****
{
if (rtl_dump_file)
fprintf (rtl_dump_file, ";; Peeling unsuccessful\n");
! return 0;
}
free (wont_exit);
--- 778,784 ----
{
if (rtl_dump_file)
fprintf (rtl_dump_file, ";; Peeling unsuccessful\n");
! return false;
}
free (wont_exit);
*************** peel_loop_simple (loops, loop, npeel)
*** 782,792 ****
if (rtl_dump_file)
fprintf (rtl_dump_file, ";; Peeling loop %d times\n", npeel);
! return 1;
}
/* Unroll a LOOP. Returs 0 if impossible, 1 otherwise. */
! static int
unroll_loop_stupid (loops, loop, nunroll)
struct loops *loops;
struct loop *loop;
--- 786,796 ----
if (rtl_dump_file)
fprintf (rtl_dump_file, ";; Peeling loop %d times\n", npeel);
! return true;
}
/* Unroll a LOOP. Returs 0 if impossible, 1 otherwise. */
! static bool
unroll_loop_stupid (loops, loop, nunroll)
struct loops *loops;
struct loop *loop;
*************** unroll_loop_stupid (loops, loop, nunroll
*** 802,827 ****
{
if (rtl_dump_file)
fprintf (rtl_dump_file, ";; Not unrolling loop, can't duplicate\n");
! return 0;
}
free (wont_exit);
if (rtl_dump_file)
fprintf (rtl_dump_file, ";; Unrolled loop %d times\n", nunroll);
! return 1;
}
/* Unroll or peel (depending on FLAGS) LOOP. */
! static int
unroll_or_peel_loop (loops, loop, flags)
struct loops *loops;
struct loop *loop;
int flags;
{
! int nunroll, npeel, ninsns, ret;
struct loop_desc desc;
- HOST_WIDE_INT niter;
bool simple, exact;
/* Do not unroll/peel cold areas. */
--- 806,831 ----
{
if (rtl_dump_file)
fprintf (rtl_dump_file, ";; Not unrolling loop, can't duplicate\n");
! return false;
}
free (wont_exit);
if (rtl_dump_file)
fprintf (rtl_dump_file, ";; Unrolled loop %d times\n", nunroll);
! return true;
}
/* Unroll or peel (depending on FLAGS) LOOP. */
! static void
unroll_or_peel_loop (loops, loop, flags)
struct loops *loops;
struct loop *loop;
int flags;
{
! int ninsns;
! unsigned HOST_WIDE_INT nunroll, npeel, niter;
struct loop_desc desc;
bool simple, exact;
/* Do not unroll/peel cold areas. */
*************** unroll_or_peel_loop (loops, loop, flags)
*** 829,845 ****
{
if (rtl_dump_file)
fprintf (rtl_dump_file, ";; Not unrolling/peeling loop, cold area\n");
! return 1;
}
/* Can the loop be manipulated? */
if (!can_duplicate_loop_p (loop))
{
if (rtl_dump_file)
! fprintf (rtl_dump_file, ";; Not unrolling/peeling loop, cannot duplicate\n");
! return 1;
}
!
/* Only peel innermost loops. */
if (loop->inner)
{
--- 833,850 ----
{
if (rtl_dump_file)
fprintf (rtl_dump_file, ";; Not unrolling/peeling loop, cold area\n");
! return;
}
/* Can the loop be manipulated? */
if (!can_duplicate_loop_p (loop))
{
if (rtl_dump_file)
! fprintf (rtl_dump_file,
! ";; Not unrolling/peeling loop, cannot duplicate\n");
! return;
}
!
/* Only peel innermost loops. */
if (loop->inner)
{
*************** unroll_or_peel_loop (loops, loop, flags)
*** 853,865 ****
/* npeel = number of iterations to peel. */
npeel = PARAM_VALUE (PARAM_MAX_PEELED_INSNS) / ninsns - 1;
! if (npeel > PARAM_VALUE (PARAM_MAX_PEEL_TIMES))
npeel = PARAM_VALUE (PARAM_MAX_PEEL_TIMES);
/* nunroll = total number of copies of the original loop body in
unrolled loop (i.e. if it is 2, we have to duplicate loop body once. */
nunroll = PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS) / ninsns;
! if (nunroll > PARAM_VALUE (PARAM_MAX_UNROLL_TIMES))
nunroll = PARAM_VALUE (PARAM_MAX_UNROLL_TIMES);
/* Skip big loops. */
--- 858,870 ----
/* npeel = number of iterations to peel. */
npeel = PARAM_VALUE (PARAM_MAX_PEELED_INSNS) / ninsns - 1;
! if (npeel > (unsigned) PARAM_VALUE (PARAM_MAX_PEEL_TIMES))
npeel = PARAM_VALUE (PARAM_MAX_PEEL_TIMES);
/* nunroll = total number of copies of the original loop body in
unrolled loop (i.e. if it is 2, we have to duplicate loop body once. */
nunroll = PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS) / ninsns;
! if (nunroll > (unsigned) PARAM_VALUE (PARAM_MAX_UNROLL_TIMES))
nunroll = PARAM_VALUE (PARAM_MAX_UNROLL_TIMES);
/* Skip big loops. */
*************** unroll_or_peel_loop (loops, loop, flags)
*** 879,885 ****
/* Shortcut. */
if (!flags)
! return 1;
/* Check for simple loops. */
simple = simple_loop_p (loops, loop, &desc);
--- 884,890 ----
/* Shortcut. */
if (!flags)
! return;
/* Check for simple loops. */
simple = simple_loop_p (loops, loop, &desc);
*************** unroll_or_peel_loop (loops, loop, flags)
*** 898,915 ****
if (count_loop_iterations (&desc, &niter, NULL))
exact = desc.const_iter;
else
! simple = false;
}
- if (exact && niter < 0)
- {
- /* Negative number of iterations; it may be overflow. */
- if (desc.cond == NE)
- /* It is hard to say what the number of iterations will be;
- but we may expect it to be high. */
- niter = 2 * nunroll;
- else
- niter = 0;
- }
if (!exact)
{
--- 903,910 ----
if (count_loop_iterations (&desc, &niter, NULL))
exact = desc.const_iter;
else
! simple = false;
}
if (!exact)
{
*************** unroll_or_peel_loop (loops, loop, flags)
*** 925,931 ****
if (niter > npeel)
{
if ((flags & UAP_PEEL) && rtl_dump_file)
! fprintf (rtl_dump_file, ";; Not peeling loop, rolls too much (%d iterations > %d [maximum peelings])\n", niter, npeel);
flags &= ~UAP_PEEL;
}
npeel = niter;
--- 920,928 ----
if (niter > npeel)
{
if ((flags & UAP_PEEL) && rtl_dump_file)
! fprintf (rtl_dump_file,
! ";; Not peeling loop, rolls too much (%d iterations > %d [maximum peelings])\n",
! niter, npeel);
flags &= ~UAP_PEEL;
}
npeel = niter;
*************** unroll_or_peel_loop (loops, loop, flags)
*** 949,955 ****
/* Shortcut. */
if (!flags)
! return 1;
/* If we still may both unroll and peel, then unroll. */
if ((flags & UAP_UNROLL) && (flags & UAP_PEEL))
--- 946,952 ----
/* Shortcut. */
if (!flags)
! return;
/* If we still may both unroll and peel, then unroll. */
if ((flags & UAP_UNROLL) && (flags & UAP_PEEL))
*************** unroll_or_peel_loop (loops, loop, flags)
*** 967,993 ****
if (simple)
{
if (desc.const_iter)
! /* Loops with constant number of iterations. */
! ret = unroll_loop_constant_iterations (loops, loop, nunroll, &desc);
else
! /* Loops with countable number of iterations. */
! ret = unroll_loop_runtime_iterations (loops, loop, nunroll, &desc);
}
else
/* Stupid unrolling. */
! ret = unroll_loop_stupid (loops, loop, nunroll);
}
else
{
! /* Peeling: */
if (simple && desc.const_iter)
! /* Peel and remove the loop completely. */
! ret = peel_loop_completely (loops, loop, &desc);
else
! /* Simple loop peeling. */
! ret = peel_loop_simple (loops, loop, npeel);
}
! return ret;
}
--- 964,992 ----
if (simple)
{
if (desc.const_iter)
! /* Loops with constant number of iterations. */
! unroll_loop_constant_iterations (loops, loop, (int) nunroll,
! &desc);
else
! /* Loops with countable number of iterations. */
! unroll_loop_runtime_iterations (loops, loop, (int) nunroll,
! &desc);
}
else
/* Stupid unrolling. */
! unroll_loop_stupid (loops, loop, (int) nunroll);
}
else
{
! /* Peeling: */
if (simple && desc.const_iter)
! /* Peel and remove the loop completely. */
! peel_loop_completely (loops, loop, &desc);
else
! /* Simple loop peeling. */
! peel_loop_simple (loops, loop, (int) npeel);
}
! return;
}