[LLVMdev] Branch transformation with branch-weight metadata

Chandler Carruth chandlerc at google.com
Tue Aug 30 23:51:27 PDT 2011


On Tue, Aug 30, 2011 at 10:25 PM, Hae-woo Park <starlet at iris.snu.ac.kr>wrote:

>
> Hello :)
>
> I am looking around __builtin_expect() directive for optimization.
> ( http://llvm.org/docs/BranchWeightMetadata.html )
> Since it is not included in v2.9, I am searching about it on svn trunk.
>
> I found that the lowering phase generates branch-weight metadata node for
> that directive.
> However, I can't find any code related to the metadata even in the branch
> transformation code.
> IMHO, in case the branch direction is, for example, reversed for
> optimization,
> the corresponding branch-weight metadata also has to be changed.
>
> In what code can I find such a metadata management code ?
> Can anyone give me a hint ?
>

lib/Analysis/BranchProbabilityInfo.cpp (and the accompanying header) provide
an LLVM Analysis pass that should model metadata, as well as
__builtin_expect() information, and various generally accepted static branch
probabilities. It is likely what you're looking for.

You can also find a MachineBranchProbabilityInfo pass that operates at the
machine layer to guide architecture-specific optimization and passes that
need the same set of information.


>
> Thank you.
> Have a nice day. :)
>
>
>
> Regards,
> Hae-woo Park
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110830/5fa35647/attachment.html>


More information about the llvm-dev mailing list