|
LLVM
5.0.0
|
#include "llvm/Transforms/PGOInstrumentation.h"#include "CFGMST.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/Statistic.h"#include "llvm/ADT/Triple.h"#include "llvm/Analysis/BlockFrequencyInfo.h"#include "llvm/Analysis/BranchProbabilityInfo.h"#include "llvm/Analysis/CFG.h"#include "llvm/Analysis/IndirectCallSiteVisitor.h"#include "llvm/Analysis/LoopInfo.h"#include "llvm/IR/CallSite.h"#include "llvm/IR/DiagnosticInfo.h"#include "llvm/IR/Dominators.h"#include "llvm/IR/GlobalValue.h"#include "llvm/IR/IRBuilder.h"#include "llvm/IR/InstIterator.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/MDBuilder.h"#include "llvm/IR/Module.h"#include "llvm/Pass.h"#include "llvm/ProfileData/InstrProfReader.h"#include "llvm/ProfileData/ProfileCommon.h"#include "llvm/Support/BranchProbability.h"#include "llvm/Support/DOTGraphTraits.h"#include "llvm/Support/Debug.h"#include "llvm/Support/GraphWriter.h"#include "llvm/Support/JamCRC.h"#include "llvm/Transforms/Instrumentation.h"#include "llvm/Transforms/Utils/BasicBlockUtils.h"#include <algorithm>#include <string>#include <unordered_map>#include <utility>#include <vector>Go to the source code of this file.
Classes | |
| struct | llvm::GraphTraits< PGOUseFunc * > |
| struct | llvm::DOTGraphTraits< PGOUseFunc * > |
Namespaces | |
| llvm | |
| Compute iterated dominance frontiers using a linear time algorithm. | |
Macros | |
| #define | DEBUG_TYPE "pgo-instrumentation" |
Enumerations | |
| enum | VisitMode |
| The select instruction visitor plays three roles specified by the mode. More... | |
Functions | |
| STATISTIC (NumOfPGOInstrument,"Number of edges instrumented.") | |
| STATISTIC (NumOfPGOSelectInsts,"Number of select instruction instrumented.") | |
| STATISTIC (NumOfPGOMemIntrinsics,"Number of mem intrinsics instrumented.") | |
| STATISTIC (NumOfPGOEdge,"Number of edges.") | |
| STATISTIC (NumOfPGOBB,"Number of basic-blocks.") | |
| STATISTIC (NumOfPGOSplit,"Number of critical edge splits.") | |
| STATISTIC (NumOfPGOFunc,"Number of functions having valid profile counts.") | |
| STATISTIC (NumOfPGOMismatch,"Number of functions having mismatch profile.") | |
| STATISTIC (NumOfPGOMissing,"Number of functions without profile.") | |
| STATISTIC (NumOfPGOICall,"Number of indirect call value instrumentations.") | |
| INITIALIZE_PASS_BEGIN (PGOInstrumentationGenLegacyPass,"pgo-instr-gen","PGO instrumentation.", false, false) INITIALIZE_PASS_END(PGOInstrumentationGenLegacyPass | |
| INITIALIZE_PASS_BEGIN (PGOInstrumentationUseLegacyPass,"pgo-instr-use","Read PGO instrumentation profile.", false, false) INITIALIZE_PASS_END(PGOInstrumentationUseLegacyPass | |
| static void | createIRLevelProfileFlagVariable (Module &M) |
| static void | collectComdatMembers (Module &M, std::unordered_multimap< Comdat *, GlobalValue * > &ComdatMembers) |
| static bool | InstrumentAllFunctions (Module &M, function_ref< BranchProbabilityInfo *(Function &)> LookupBPI, function_ref< BlockFrequencyInfo *(Function &)> LookupBFI) |
| static bool | annotateAllFunctions (Module &M, StringRef ProfileFileName, function_ref< BranchProbabilityInfo *(Function &)> LookupBPI, function_ref< BlockFrequencyInfo *(Function &)> LookupBFI) |
| void | llvm::setProfMetadata (Module *M, Instruction *TI, ArrayRef< uint64_t > EdgeCounts, uint64_t MaxCount) |
| static std::string | llvm::getSimpleNodeName (const BasicBlock *Node) |
Variables | |
| static cl::opt< std::string > | PGOTestProfileFile ("pgo-test-profile-file", cl::init(""), cl::Hidden, cl::value_desc("filename"), cl::desc("Specify the path of profile data file. This is""mainly for test purpose.")) |
| static cl::opt< bool > | DisableValueProfiling ("disable-vp", cl::init(false), cl::Hidden, cl::desc("Disable Value Profiling")) |
| static cl::opt< unsigned > | MaxNumAnnotations ("icp-max-annotations", cl::init(3), cl::Hidden, cl::ZeroOrMore, cl::desc("Max number of annotations for a single indirect ""call callsite")) |
| static cl::opt< unsigned > | MaxNumMemOPAnnotations ("memop-max-annotations", cl::init(4), cl::Hidden, cl::ZeroOrMore, cl::desc("Max number of preicise value annotations for a single memop""intrinsic")) |
| static cl::opt< bool > | DoComdatRenaming ("do-comdat-renaming", cl::init(false), cl::Hidden, cl::desc("Append function hash to the name of COMDAT function to avoid ""function hash mismatch due to the preinliner")) |
| static cl::opt< bool > | PGOWarnMissing ("pgo-warn-missing-function", cl::init(false), cl::Hidden, cl::desc("Use this option to turn on/off ""warnings about missing profile data for ""functions.")) |
| static cl::opt< bool > | NoPGOWarnMismatch ("no-pgo-warn-mismatch", cl::init(false), cl::Hidden, cl::desc("Use this option to turn off/on ""warnings about profile cfg mismatch.")) |
| static cl::opt< bool > | NoPGOWarnMismatchComdat ("no-pgo-warn-mismatch-comdat", cl::init(true), cl::Hidden, cl::desc("The option is used to turn on/off ""warnings about hash mismatch for comdat ""functions.")) |
| static cl::opt< bool > | PGOInstrSelect ("pgo-instr-select", cl::init(true), cl::Hidden, cl::desc("Use this option to turn on/off SELECT ""instruction instrumentation. ")) |
| static cl::opt< bool > | PGOViewRawCounts ("pgo-view-raw-counts", cl::init(false), cl::Hidden, cl::desc("A boolean option to show CFG dag ""with raw profile counts from ""profile data. See also option ""-pgo-view-counts. To limit graph ""display to only one function, use ""filtering option -view-bfi-func-name.")) |
| static cl::opt< bool > | PGOInstrMemOP ("pgo-instr-memop", cl::init(true), cl::Hidden, cl::desc("Use this option to turn on/off ""memory intrinsic size profiling.")) |
| static cl::opt< bool > | EmitBranchProbability ("pgo-emit-branch-prob", cl::init(false), cl::Hidden, cl::desc("When this option is on, the annotated ""branch probability will be emitted as "" optimization remarks: -Rpass-analysis=""pgo-instr-use")) |
| cl::opt< bool > | PGOViewCounts |
| cl::opt< std::string > | ViewBlockFreqFuncName |
| pgo instr | gen |
| pgo instr PGO | instrumentation |
| pgo instr PGO | false |
| pgo instr | use |
| pgo instr Read PGO instrumentation | profile |
| #define DEBUG_TYPE "pgo-instrumentation" |
Definition at line 90 of file PGOInstrumentation.cpp.
| enum VisitMode |
The select instruction visitor plays three roles specified by the mode.
In VM_counting mode, it simply counts the number of select instructions. In VM_instrument mode, it inserts code to count the number times TrueValue of select is taken. In VM_annotate mode, it reads the profile data and annotate the select instruction with metadata.
Definition at line 241 of file PGOInstrumentation.cpp.
|
static |
Definition at line 1331 of file PGOInstrumentation.cpp.
References llvm::CallingConv::Cold, collectComdatMembers(), llvm::IndexedInstrProfReader::create(), llvm::StringRef::data(), llvm::dbgs(), DEBUG, F, llvm::Module::getContext(), llvm::handleAllErrors(), llvm::ErrorInfoBase::message(), PGOViewCounts, PGOViewRawCounts, ViewBlockFreqFuncName, llvm::ViewGraph(), and llvm::WriteGraph().
Referenced by llvm::PGOInstrumentationUse::run().
|
static |
Definition at line 1267 of file PGOInstrumentation.cpp.
References DoComdatRenaming.
Referenced by annotateAllFunctions(), and InstrumentAllFunctions().
|
static |
Definition at line 1249 of file PGOInstrumentation.cpp.
References llvm::GlobalValue::DefaultVisibility, llvm::GlobalValue::ExternalLinkage, llvm::Module::getContext(), llvm::Type::getInt64Ty(), llvm::Constant::getIntegerValue(), llvm::Module::getOrInsertComdat(), llvm::Module::getTargetTriple(), and llvm::GlobalValue::WeakAnyLinkage.
Referenced by InstrumentAllFunctions().
| INITIALIZE_PASS_BEGIN | ( | PGOInstrumentationGenLegacyPass | , |
| "pgo-instr-gen" | , | ||
| "PGO instrumentation." | , | ||
| false | , | ||
| false | |||
| ) |
| INITIALIZE_PASS_BEGIN | ( | PGOInstrumentationUseLegacyPass | , |
| "pgo-instr-use" | , | ||
| "Read PGO instrumentation profile." | , | ||
| false | , | ||
| false | |||
| ) |
|
static |
Definition at line 1283 of file PGOInstrumentation.cpp.
References collectComdatMembers(), and createIRLevelProfileFlagVariable().
Referenced by llvm::PGOInstrumentationGen::run().
| STATISTIC | ( | NumOfPGOInstrument | , |
| "Number of edges instrumented." | |||
| ) |
| STATISTIC | ( | NumOfPGOSelectInsts | , |
| "Number of select instruction instrumented." | |||
| ) |
| STATISTIC | ( | NumOfPGOMemIntrinsics | , |
| "Number of mem intrinsics instrumented." | |||
| ) |
| STATISTIC | ( | NumOfPGOEdge | , |
| "Number of edges." | |||
| ) |
| STATISTIC | ( | NumOfPGOBB | , |
| "Number of basic-blocks." | |||
| ) |
| STATISTIC | ( | NumOfPGOSplit | , |
| "Number of critical edge splits." | |||
| ) |
| STATISTIC | ( | NumOfPGOMismatch | , |
| "Number of functions having mismatch profile." | |||
| ) |
| STATISTIC | ( | NumOfPGOMissing | , |
| "Number of functions without profile." | |||
| ) |
| STATISTIC | ( | NumOfPGOICall | , |
| "Number of indirect call value instrumentations." | |||
| ) |
|
static |
|
static |
Referenced by collectComdatMembers().
|
static |
Referenced by llvm::setProfMetadata().
| pgo instr Read PGO instrumentation false |
Definition at line 386 of file PGOInstrumentation.cpp.
| pgo instr gen |
Definition at line 386 of file PGOInstrumentation.cpp.
| pgo instr PGO instrumentation |
Definition at line 386 of file PGOInstrumentation.cpp.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Referenced by llvm::DOTGraphTraits< PGOUseFunc * >::getNodeLabel().
|
static |
Referenced by llvm::PGOInstrumentationUse::PGOInstrumentationUse().
Referenced by annotateAllFunctions(), and llvm::getGVDT().
|
static |
Referenced by annotateAllFunctions().
|
static |
| pgo instr Read PGO instrumentation profile |
Definition at line 398 of file PGOInstrumentation.cpp.
| pgo instr use |
Definition at line 398 of file PGOInstrumentation.cpp.
| cl::opt<std::string> ViewBlockFreqFuncName |
Referenced by annotateAllFunctions(), and llvm::BlockFrequencyInfo::calculate().
1.8.6