X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FBranchWeightMetadata.rst;h=6cbcb0f0fb241e12a7dabdc2eb20ac0b3090dcbc;hb=daaec40323619188f16f744af624de4b30755f56;hp=aff7923d18656d4531208c9e0afefabf8fbc0a11;hpb=23a6033104c5f3fde8fe3b359d25e57a728613aa;p=oota-llvm.git diff --git a/docs/BranchWeightMetadata.rst b/docs/BranchWeightMetadata.rst index aff7923d186..6cbcb0f0fb2 100644 --- a/docs/BranchWeightMetadata.rst +++ b/docs/BranchWeightMetadata.rst @@ -27,7 +27,7 @@ Supported Instructions ^^^^^^^^^^^^^^ Metadata is only assigned to the conditional branches. There are two extra -operarands for the true and the false branch. +operands for the true and the false branch. .. code-block:: llvm @@ -114,4 +114,27 @@ CFG Modifications Branch Weight Metatada is not proof against CFG changes. If terminator operands' are changed some action should be taken. In other case some misoptimizations may -occur due to incorrent branch prediction information. +occur due to incorrect branch prediction information. + +Function Entry Counts +===================== + +To allow comparing different functions during inter-procedural analysis and +optimization, ``MD_prof`` nodes can also be assigned to a function definition. +The first operand is a string indicating the name of the associated counter. + +Currently, one counter is supported: "function_entry_count". This is a 64-bit +counter that indicates the number of times that this function was invoked (in +the case of instrumentation-based profiles). In the case of sampling-based +profiles, this counter is an approximation of how many times the function was +invoked. + +For example, in the code below, the instrumentation for function foo() +indicates that it was called 2,590 times at runtime. + +.. code-block:: llvm + + define i32 @foo() !prof !1 { + ret i32 0 + } + !1 = !{!"function_entry_count", i64 2590}