[PATCH] D12341: add llvm.unpredictable intrinsic and lower it to metadata

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 17:39:10 PDT 2015


On Thu, Aug 27, 2015 at 3:13 PM, Kevin B. Smith via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> kbsmith1 added a comment.
>
> No, I am not suggesting you have more history.  I am suggesting that you
> only have a single number that represents the percentage of time that the
> direction is mispredicted.  It would make a lot of sense for it to be a
> simple 0-100 value, and would represent the percentage of mispredictions.
> Anything else takes more space, and is much too closely tied to the branch
> predictor.
>

I have seen 2 independent bug reports recently where the simple annotation
to the compiler "assume that this is completely unpredictable" would have
been the solution. Some pieces of code very closely approximate this,
especially in decompression algorithms where by definition if the encoder
is doing its job then the pattern cannot be guessed. Other data-driven
branches can approximate this behavior as well.

This is more a declaration about the actual pattern of the branch. A number
indicating the percentage of mispredictions (or any empirically collected
number) is not a generalization of this annotation.

-- Sean Silva


>
> ABAB can be perfectly predicted often, AABB can be perfectly predicted
> often. The number of transitions from true to false or vice-versa has a poor
> correlation to branch predictability, just as the branch probability has a
> poor correlation to branch predictability.
>
>
> http://reviews.llvm.org/D12341
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150827/c5a62969/attachment.html>


More information about the llvm-commits mailing list