diff options
author | Diego Novillo <dnovillo@google.com> | 2015-05-13 15:13:45 +0000 |
---|---|---|
committer | Diego Novillo <dnovillo@google.com> | 2015-05-13 15:13:45 +0000 |
commit | a3bccceda7ca4d8e8fe8541675b594b4b7ba4148 (patch) | |
tree | 4b488412cdbfe7573f1c762447a1f08c38bd94e5 /docs | |
parent | dcc57103b82525a35a9e7acc0109d20a83b2b0a0 (diff) |
Add function entry count metadata.
Summary:
This adds three Function methods to handle function entry counts:
setEntryCount() and getEntryCount().
Entry counts are stored under the MD_prof metadata node with the name
"function_entry_count". They are unsigned 64 bit values set by profilers
(instrumentation and sample profiler changes coming up).
Added documentation for new profile metadata and tests.
Reviewers: dexonsmith, bogner
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D9628
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237260 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r-- | docs/BranchWeightMetadata.rst | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/BranchWeightMetadata.rst b/docs/BranchWeightMetadata.rst index aff7923d186..2ebc6c32416 100644 --- a/docs/BranchWeightMetadata.rst +++ b/docs/BranchWeightMetadata.rst @@ -115,3 +115,26 @@ 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. + +Function Entry Counts +===================== + +To allow comparing different functions durint 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} |