aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@gcc.gnu.org>2001-06-12 10:22:22 +0000
committerJan Hubicka <hubicka@gcc.gnu.org>2001-06-12 10:22:22 +0000
commitaa18f20e7406ee235e94d6360bf4b3e349088544 (patch)
tree487d80a5d58a9011b3ff04980963adc35c2b444a /gcc/loop.c
parent7bdcf888aaa78808dc2dd4e16e70458244a607be (diff)
downloadgcc-aa18f20e7406ee235e94d6360bf4b3e349088544.zip
gcc-aa18f20e7406ee235e94d6360bf4b3e349088544.tar.gz
gcc-aa18f20e7406ee235e94d6360bf4b3e349088544.tar.bz2
loop.c: Include predict.h
* loop.c: Include predict.h (strength_reduce): Drop branch prediction note in case number of iterations is known. * predict.def (PRED_LOOP_ITERATIONS): new. * Makefile.in (loop.o): Add dependancy on predict.h From-SVN: r43251
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index 34bc862..fac9a84 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -52,6 +52,7 @@ Boston, MA 02111-1307, USA. */
#include "cselib.h"
#include "except.h"
#include "toplev.h"
+#include "predict.h"
#define LOOP_REG_LIFETIME(LOOP, REGNO) \
((REGNO_LAST_LUID (REGNO) - REGNO_FIRST_LUID (REGNO)))
@@ -4498,6 +4499,18 @@ strength_reduce (loop, flags)
doloop_optimize (loop);
#endif /* HAVE_doloop_end */
+ /* In case number of iterations is known, drop branch prediction note
+ in the branch. Do that only in second loop pass, as loop unrolling
+ may change the number of iterations performed. */
+ if ((flags & LOOP_BCT)
+ && loop_info->n_iterations / loop_info->unroll_number > 1)
+ {
+ int n = loop_info->n_iterations / loop_info->unroll_number - 1;
+ predict_insn (PREV_INSN (loop->end),
+ PRED_LOOP_ITERATIONS,
+ REG_BR_PROB_BASE - REG_BR_PROB_BASE / n);
+ }
+
if (loop_dump_stream)
fprintf (loop_dump_stream, "\n");