1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
llvm-mirror/lib
Dehao Chen 0f5497429b Implement callsite-hotness based inline cost for Sample-based PGO
Summary:
For sample-based PGO, using BFI to calculate callsite count is sometime not accurate. This is because with sampling based approach, if a callsite resides in a hot loop deeply nested in a bunch of cold branches, the callsite's BFI frequency would be inaccurately calculated due to lack of samples in the cold branch.

E.g.

if (A1 && A2 && A3 && ..... && A10) {
  for (i=0; i < 100000000; i++) {
    callsite();
  }
}

Assume that A1 to A100 are all 100% taken, and callsite has 1000 samples and thus is considerred hot. Because the loop's trip count is huge, it's normal that all branches outside the loop has no sample at all. As a result, we can only use static branch probability to derive the the frequency of the loop header. Assuming that static heuristic thinks each branch is 50% taken, then the count calculated from BFI will be 1/(2^10) of the actual value.

In order to get more accurate callsite count, we directly annotate the weight on the call instruction, and directly use it when checking callsite hotness.

Note that this mechanism can also be shared by instrumentation based callsite hotness analysis. The side benefit is that it breaks the dependency from Inliner to BFI as call count is embedded in the IR.

Reviewers: davidxl, eraman, dnovillo

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D22118

llvm-svn: 275073
2016-07-11 16:48:54 +00:00
..
Analysis Implement callsite-hotness based inline cost for Sample-based PGO 2016-07-11 16:48:54 +00:00
AsmParser Add writeonly IR attribute 2016-07-04 08:01:29 +00:00
Bitcode Add an assertion for the value enumerator (bitcode writer) NFC 2016-07-08 01:13:41 +00:00
CodeGen Provide support for preserving assembly comments 2016-07-11 12:42:14 +00:00
DebugInfo Give helper classes/functions internal linkage. NFC. 2016-07-10 11:28:51 +00:00
ExecutionEngine Prune RelocVisitor.h include to avoid including COFF.h from MCJIT.h 2016-07-06 16:56:42 +00:00
Fuzzer [LibFuzzer] Unbreak the build on macOS which was broken by r272858. 2016-07-07 18:14:11 +00:00
IR Implement callsite-hotness based inline cost for Sample-based PGO 2016-07-11 16:48:54 +00:00
IRReader Remove autoconf support 2016-01-26 21:29:08 +00:00
LibDriver Object: Replace NewArchiveIterator with a simpler NewArchiveMember class. NFCI. 2016-06-29 22:27:42 +00:00
LineEditor Fix Clang-tidy modernize-deprecated-headers warnings in some files; other minor fixes. 2016-03-28 17:40:08 +00:00
Linker IR: New representation for CFI and virtual call optimization pass metadata. 2016-06-24 21:21:32 +00:00
LTO ThinLTO: Do not take into account whether a definition has multiple copies when promoting. 2016-07-07 18:31:51 +00:00
MC Fix branch relaxation in 16-bit mode. 2016-07-11 14:23:53 +00:00
Object Add checks to the MachOObjectFile() constructor to make sure load commands sizes 2016-07-07 22:11:42 +00:00
ObjectYAML [YAML] Fix YAML tags appearing before the start of sequence elements 2016-06-28 21:10:26 +00:00
Option Option parser: class for consuming a joined arg in addition to all remaining args 2016-04-15 00:23:30 +00:00
Passes [PM] Port LoopVectorize to the new PM. 2016-07-09 22:56:50 +00:00
ProfileData Revert "[Coverage] Move logic to encode filenames and mappings into llvm (NFC)" 2016-06-29 05:33:26 +00:00
Support [Support] Make helper function static. NFC. 2016-07-10 16:11:53 +00:00
TableGen TableGen: promote "code" type from syntactic sugar. 2016-07-05 21:22:55 +00:00
Target Add missing include from previous commit 2016-07-11 14:32:57 +00:00
Transforms Implement callsite-hotness based inline cost for Sample-based PGO 2016-07-11 16:48:54 +00:00
CMakeLists.txt Move ObjectYAML code to a new library. 2016-03-01 19:15:06 +00:00
LLVMBuild.txt Add LLVMBuild for ObjectYAML. 2016-03-01 21:29:33 +00:00