insn-config.h output.h $(REGS_H) $(EXPR_H) function.h \
gcov-io.h toplev.h $(GGC_H) hard-reg-set.h $(BASIC_BLOCK_H)
loop.o : loop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h $(LOOP_H) insn-config.h \
- $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) real.h \
+ $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) real.h $(PREDICT_H) \
$(BASIC_BLOCK_H) function.h toplev.h varray.h except.h cselib.h $(TM_P_H)
doloop.o : doloop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h $(LOOP_H) \
$(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) toplev.h
#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)))
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");
DEF_PREDICTOR (PRED_FIRST_MATCH, "first match", PROB_ALWAYS)
DEF_PREDICTOR (PRED_UNCONDITIONAL, "unconditional jump", PROB_ALWAYS)
+DEF_PREDICTOR (PRED_LOOP_ITERATIONS, "loop iterations", PROB_ALWAYS)
DEF_PREDICTOR (PRED_BUILTIN_EXPECT, "__builtin_expect", PROB_VERY_LIKELY)
DEF_PREDICTOR (PRED_NORETURN, "noreturn call", PROB_ALWAYS)
DEF_PREDICTOR (PRED_LOOP_BRANCH, "loop branch", PROB_VERY_LIKELY)