[PATCH] D12341: add llvm.unpredictable intrinsic and lower it to metadata
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 27 14:54:35 PDT 2015
kparzysz added a comment.
In http://reviews.llvm.org/D12341#234522, @kbsmith1 wrote:
> I don't think you want to do the number of times that the branch changed directions. Hal made the comment that even 50% either way branches can have perfect prediction. The example he gave was of long runs of one direction, and then long runs of another direction.
So the branch changes direction once, which (assuming large number of executions) gives the probability of changing direction close to 0. With a branch that alternates each time, the value would be close to 1. We don't want to mimic any specific behavior of a branch predictor, but we need to settle on a some model. This one assumes knowledge of the single, most recent execution of the branch. It loses information about the direction of the change itself, i.e. whether it was A->B or B->A. Are you suggesting longer history? More complete information, e.g. all of P(A|A), P(A|B), P(B|A) and P(B|B)?
http://reviews.llvm.org/D12341
More information about the llvm-commits
mailing list