This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[rtlopt] Unroller fixes
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: gcc-patches at gcc dot gnu dot org, jh at suse dot cz
- Date: Sun, 10 Nov 2002 14:35:36 +0100
- Subject: [rtlopt] Unroller fixes
Hello,
fixes for trivial bugs in new decision and loop histogram code.
Zdenek
Changelog:
* profile.c (gen_loop_profiler): Fix.
* loop-unroll.c (decide_unroll_constant_iterations,
decide_unroll_runtime_iterations, decide_peel_simple,
decide_unroll_stupid): Fix.
Index: profile.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/profile.c,v
retrieving revision 1.97.2.3
retrieving revision 1.97.2.4
diff -c -3 -p -r1.97.2.3 -r1.97.2.4
*** profile.c 9 Nov 2002 17:52:10 -0000 1.97.2.3
--- profile.c 10 Nov 2002 13:18:40 -0000 1.97.2.4
*************** gen_loop_profiler (iterations, loop, ste
*** 2062,2068 ****
int steps;
{
enum machine_mode mode = mode_for_size (GCOV_TYPE_SIZE, MODE_INT, 0);
! rtx mem_ref, tmp, tmp1, mr, lab, jump;
rtx sequence;
int base = (loop - 1) * (steps + 1);
rtx in_range_label = gen_label_rtx ();
--- 2062,2068 ----
int steps;
{
enum machine_mode mode = mode_for_size (GCOV_TYPE_SIZE, MODE_INT, 0);
! rtx mem_ref, tmp, tmp1, mr;
rtx sequence;
int base = (loop - 1) * (steps + 1);
rtx in_range_label = gen_label_rtx ();
*************** gen_loop_profiler (iterations, loop, ste
*** 2079,2097 ****
do_compare_rtx_and_jump (iterations, GEN_INT (steps), GE, 0, mode, NULL_RTX,
in_range_label, NULL_RTX);
- jump = get_last_insn ();
- JUMP_LABEL (jump) = in_range_label;
tmp1 = expand_simple_binop (Pmode, PLUS, tmp, GEN_INT (per_counter * steps), mr, 0, OPTAB_WIDEN);
if (tmp1 != mr)
emit_move_insn (mr, tmp1);
! jump = emit_jump_insn (gen_jump (end_of_code_label));
! JUMP_LABEL (jump) = end_of_code_label;
emit_barrier ();
! lab = emit_label (in_range_label);
! LABEL_NUSES (lab) = 1;
tmp1 = expand_simple_binop (mode, MULT, iterations, GEN_INT (per_counter),
NULL_RTX, 0, OPTAB_WIDEN);
--- 2079,2093 ----
do_compare_rtx_and_jump (iterations, GEN_INT (steps), GE, 0, mode, NULL_RTX,
in_range_label, NULL_RTX);
tmp1 = expand_simple_binop (Pmode, PLUS, tmp, GEN_INT (per_counter * steps), mr, 0, OPTAB_WIDEN);
if (tmp1 != mr)
emit_move_insn (mr, tmp1);
! emit_jump_insn (gen_jump (end_of_code_label));
emit_barrier ();
! emit_label (in_range_label);
tmp1 = expand_simple_binop (mode, MULT, iterations, GEN_INT (per_counter),
NULL_RTX, 0, OPTAB_WIDEN);
*************** gen_loop_profiler (iterations, loop, ste
*** 2099,2106 ****
if (tmp1 != mr)
emit_move_insn (mr, tmp1);
! lab = emit_label (end_of_code_label);
! LABEL_NUSES (lab) = 1;
mem_ref = validize_mem (gen_rtx_MEM (mode, mr));
--- 2095,2101 ----
if (tmp1 != mr)
emit_move_insn (mr, tmp1);
! emit_label (end_of_code_label);
mem_ref = validize_mem (gen_rtx_MEM (mode, mr));
*************** gen_loop_profiler (iterations, loop, ste
*** 2112,2117 ****
--- 2107,2113 ----
sequence = get_insns ();
end_sequence ();
+ rebuild_jump_labels (sequence);
return sequence;
}
Index: loop-unroll.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/loop-unroll.c,v
retrieving revision 1.1.2.11
diff -c -3 -p -r1.1.2.11 loop-unroll.c
*** loop-unroll.c 9 Nov 2002 17:52:11 -0000 1.1.2.11
--- loop-unroll.c 10 Nov 2002 12:38:30 -0000
*************** decide_unroll_constant_iterations (loops
*** 411,417 ****
{
unsigned nunroll, best_copies, best_unroll, n_copies, i;
! if (!flags & UAP_UNROLL)
{
/* We were not asked to, just return back silently. */
return;
--- 411,417 ----
{
unsigned nunroll, best_copies, best_unroll, n_copies, i;
! if (!(flags & UAP_UNROLL))
{
/* We were not asked to, just return back silently. */
return;
*************** decide_unroll_runtime_iterations (loops,
*** 603,609 ****
{
unsigned nunroll, i;
! if (!flags & UAP_UNROLL)
{
/* We were not asked to, just return back silently. */
return;
--- 603,609 ----
{
unsigned nunroll, i;
! if (!(flags & UAP_UNROLL))
{
/* We were not asked to, just return back silently. */
return;
*************** decide_peel_simple (loops, loop, flags)
*** 873,879 ****
{
unsigned npeel, i;
! if (!flags & UAP_PEEL)
{
/* We were not asked to, just return back silently. */
return;
--- 873,879 ----
{
unsigned npeel, i;
! if (!(flags & UAP_PEEL))
{
/* We were not asked to, just return back silently. */
return;
*************** decide_unroll_stupid (loops, loop, flags
*** 1001,1007 ****
{
unsigned nunroll;
! if (!flags & UAP_UNROLL_ALL)
{
/* We were not asked to, just return back silently. */
return;
--- 1001,1007 ----
{
unsigned nunroll;
! if (!(flags & UAP_UNROLL_ALL))
{
/* We were not asked to, just return back silently. */
return;