This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Use guessed number of iterations in predict
- From: Jan Hubicka <jh at suse dot cz>
- To: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- Cc: gcc-patches at gcc dot gnu dot org, jh at suse dot cz
- Date: Sun, 25 Feb 2007 16:53:24 +0100
- Subject: Re: [patch] Use guessed number of iterations in predict
- References: <20070223120725.GA14633@atrey.karlin.mff.cuni.cz>
> Hello,
>
> guessed loop iterations 729 0.8% 92.61% / 92.72% 2837896526 4.5%
Nice, this was something I planed for a while...
> *************** DEF_PREDICTOR (PRED_LOOP_ITERATIONS, "lo
> *** 62,67 ****
> --- 62,71 ----
> DEF_PREDICTOR (PRED_BUILTIN_EXPECT, "__builtin_expect", PROB_VERY_LIKELY,
> PRED_FLAG_FIRST_MATCH)
>
> + /* Use number of loop iterations guessed by the contents of the loop. */
> + DEF_PREDICTOR (PRED_LOOP_ITERATIONS_GUESSED, "guessed loop iterations",
> + PROB_ALWAYS, 0)
I am not sure here, but perhaps PROP_FLAG_FIRST_MATCH would work better
here? The reason is that code for combining predictions works poorly on
predictors that actually predict precise outcome, not just the direction
with some probability. In extreme case, consider case where loop can
iterate at most 3 times, so probability is 33% that is very weak and can
be outvoted by some other heuristic easilly...
Honza