This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Use guessed number of iterations in predict


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]