From dad482e6ee7c84e9793e721c0ec1c7de6e2ca5dc Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Mon, 7 Oct 2002 17:55:46 +0000 Subject: [PATCH] Permit doloop treatment for preconditioned loops. From-SVN: r57902 --- gcc/ChangeLog | 6 ++++++ gcc/doloop.c | 1 + gcc/loop.c | 3 ++- gcc/rtl.h | 1 + gcc/unroll.c | 3 +++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 13f3151d2753..adffbeb11cc9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-10-07 Dale Johannesen + * rtl.h: Add NOTE_PRECONDITIONED. + * unroll.c: Set it. + * loop.c: Set loop_info->preconditioned from it. + * doloop.c: Permit doloop treatment when loop_info->preconditoned. + 2002-10-07 Richard Henderson * config/i960/i960.c (i960_setup_incoming_varargs): Create a diff --git a/gcc/doloop.c b/gcc/doloop.c index 3e1c7b11b3b7..1f7d47ae035c 100644 --- a/gcc/doloop.c +++ b/gcc/doloop.c @@ -339,6 +339,7 @@ doloop_valid_p (loop, jump_insn) condition at run-time and have an additional jump around the loop to ensure an infinite loop. */ if (loop_info->comparison_code == NE + && !loop_info->preconditioned && INTVAL (loop_info->increment) != -1 && INTVAL (loop_info->increment) != 1) { diff --git a/gcc/loop.c b/gcc/loop.c index 0a7fa9b262c3..5db9677ffeb9 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -2475,7 +2475,8 @@ prescan_loop (loop) loop_info->first_loop_store_insn = NULL_RTX; loop_info->mems_idx = 0; loop_info->num_mem_sets = 0; - + /* If loop opts run twice, this was set on 1st pass for 2nd. */ + loop_info->preconditioned = NOTE_PRECONDITIONED (end); for (insn = start; insn && GET_CODE (insn) != CODE_LABEL; insn = PREV_INSN (insn)) diff --git a/gcc/rtl.h b/gcc/rtl.h index d4147c221c0a..9aada8286e5b 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -787,6 +787,7 @@ extern const char * const reg_note_name[]; #define NOTE_BASIC_BLOCK(INSN) XCBBDEF (INSN, 4, NOTE) #define NOTE_EXPECTED_VALUE(INSN) XCEXP (INSN, 4, NOTE) #define NOTE_PREDICTION(INSN) XCINT (INSN, 4, NOTE) +#define NOTE_PRECONDITIONED(INSN) XCINT (INSN, 4, NOTE) /* In a NOTE that is a line number, this is the line number. Other kinds of NOTEs are identified by negative numbers here. */ diff --git a/gcc/unroll.c b/gcc/unroll.c index 3e5ea7f069a8..fa04253e0ed1 100644 --- a/gcc/unroll.c +++ b/gcc/unroll.c @@ -1136,6 +1136,9 @@ unroll_loop (loop, insn_count, strength_reduce_p) /* And whether the loop has been preconditioned. */ loop_info->preconditioned = loop_preconditioned; + /* Remember whether it was preconditioned for the second loop pass. */ + NOTE_PRECONDITIONED (loop->end) = loop_preconditioned; + /* For each biv and giv, determine whether it can be safely split into a different variable for each unrolled copy of the loop body. We precalculate and save this info here, since computing it is