57 #define DEBUG_TYPE "instrprof"
63 cl::desc(
"Set the range of size in memory intrinsic calls to be profiled "
64 "precisely, in a format of <start_val>:<end_val>"),
70 cl::desc(
"Set large value thresthold in memory intrinsic size profiling. "
71 "Value of 0 disables the large value profiling."),
77 cl::desc(
"Enable name string compression"),
81 "hash-based-counter-split",
82 cl::desc(
"Rename counter variable of a comdat function based on cfg hash"),
87 cl::desc(
"Do static counter allocation for value profiler"),
91 "vp-counters-per-site",
92 cl::desc(
"The average number of profile counters allocated "
93 "per value profiling site."),
102 cl::desc(
"Do counter update using atomic fetch add "
103 " for promoted counters only"),
112 cl::desc(
"Do counter register promotion"),
116 cl::desc(
"Max number counter promotions per loop to avoid"
117 " increasing register pressure too much"));
122 cl::desc(
"Max number of allowed counter promotions"));
126 cl::desc(
"The max number of exiting blocks of a loop to allow "
127 " speculative counter promotion"));
131 cl::desc(
"When the option is false, if the target block is in a loop, "
132 "the promotion will be disallowed unless the promoted counter "
133 " update can be further/iteratively promoted into an acyclic "
138 cl::desc(
"Allow counter promotion across the whole loop nest."));
140 class InstrProfilingLegacyPass :
public ModulePass {
151 return "Frontend instrumentation-based coverage lowering";
154 bool runOnModule(
Module &M)
override {
155 return InstrProf.run(M, getAnalysis<TargetLibraryInfoWrapperPass>().getTLI());
173 PGOCounterPromoterHelper(
180 InsertPts(InsertPts), LoopToCandidates(LoopToCands), LI(LI) {
182 assert(isa<StoreInst>(S));
183 SSA.AddAvailableValue(PH,
Init);
186 void doExtraRewritesBeforeFinalDeletion()
const override {
187 for (
unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) {
193 Value *LiveInValue =
SSA.GetValueInMiddleOfBlock(ExitBlock);
196 if (AtomicCounterUpdatePromoted)
202 LoadInst *OldVal = Builder.CreateLoad(Addr,
"pgocount.promoted");
203 auto *NewVal = Builder.CreateAdd(OldVal, LiveInValue);
204 auto *NewStore = Builder.CreateStore(NewVal, Addr);
207 if (IterativeCounterPromotion) {
208 auto *TargetLoop = LI.getLoopFor(ExitBlock);
210 LoopToCandidates[TargetLoop].emplace_back(OldVal, NewStore);
227 class PGOCounterPromoter {
232 : LoopToCandidates(LoopToCands), ExitBlocks(), InsertPts(),
L(CurLoop),
239 for (
BasicBlock *ExitBlock : LoopExitBlocks) {
240 if (BlockSet.
insert(ExitBlock).second) {
241 ExitBlocks.push_back(ExitBlock);
247 bool run(int64_t *NumPromoted) {
248 unsigned MaxProm = getMaxNumOfPromotionsInLoop(&
L);
252 unsigned Promoted = 0;
253 for (
auto &Cand : LoopToCandidates[&
L]) {
259 PGOCounterPromoterHelper Promoter(Cand.first, Cand.second,
SSA, InitVal,
260 L.getLoopPreheader(), ExitBlocks,
261 InsertPts, LoopToCandidates, LI);
264 if (Promoted >= MaxProm)
268 if (MaxNumOfPromotions != -1 && *NumPromoted >= MaxNumOfPromotions)
272 DEBUG(
dbgs() << Promoted <<
" counters promoted for loop (depth="
273 << L.getLoopDepth() <<
")\n");
274 return Promoted != 0;
278 bool allowSpeculativeCounterPromotion(
Loop *LP) {
280 L.getExitingBlocks(ExitingBlocks);
282 if (ExitingBlocks.
size() == 1)
284 if (ExitingBlocks.
size() > SpeculativeCounterPromotionMaxExiting)
290 unsigned getMaxNumOfPromotionsInLoop(
Loop *LP) {
309 if (ExitingBlocks.
size() == 1)
310 return MaxNumOfPromotionsPerLoop;
312 if (ExitingBlocks.
size() > SpeculativeCounterPromotionMaxExiting)
316 if (SpeculativeCounterPromotionToLoop)
317 return MaxNumOfPromotionsPerLoop;
320 unsigned MaxProm = MaxNumOfPromotionsPerLoop;
321 for (
auto *TargetBlock : LoopExitBlocks) {
322 auto *TargetLoop = LI.
getLoopFor(TargetBlock);
325 unsigned MaxPromForTarget = getMaxNumOfPromotionsInLoop(TargetLoop);
326 unsigned PendingCandsInTarget = LoopToCandidates[TargetLoop].size();
329 PendingCandsInTarget);
353 InstrProfilingLegacyPass,
"instrprof",
354 "Frontend instrumentation-based coverage lowering.",
false,
false)
362 return new InstrProfilingLegacyPass(Options);
372 bool InstrProfiling::lowerIntrinsics(
Function *
F) {
373 bool MadeChange =
false;
374 PromotionCandidates.clear();
376 for (
auto I = BB.begin(),
E = BB.end();
I !=
E;) {
382 }
else if (
auto *Ind = dyn_cast<InstrProfValueProfileInst>(Instr)) {
383 lowerValueProfileInst(Ind);
392 promoteCounterLoadStores(F);
396 bool InstrProfiling::isCounterPromotionEnabled()
const {
397 if (DoCounterPromotion.getNumOccurrences() > 0)
398 return DoCounterPromotion;
403 void InstrProfiling::promoteCounterLoadStores(
Function *F) {
404 if (!isCounterPromotionEnabled())
411 for (
const auto &
LoadStore : PromotionCandidates) {
418 LoopPromotionCandidates[ParentLoop].emplace_back(CounterLoad, CounterStore);
426 PGOCounterPromoter Promoter(LoopPromotionCandidates, *
Loop, LI);
427 Promoter.run(&TotalCountersPromoted);
432 bool MadeChange =
false;
438 ProfileDataMap.clear();
451 if (
auto *Ind = dyn_cast<InstrProfValueProfileInst>(
I))
452 computeNumValueSiteCounts(Ind);
453 else if (FirstProfIncInst ==
nullptr)
458 if (FirstProfIncInst !=
nullptr)
459 static_cast<void>(getOrCreateRegionCounters(FirstProfIncInst));
463 MadeChange |= lowerIntrinsics(&F);
467 lowerCoverageData(CoverageNamesVar);
479 emitInitialization();
485 bool IsRange =
false) {
491 Type *ParamTypes[] = {
492 #define VALUE_PROF_FUNC_PARAM(ParamType, ParamName, ParamLLVMType) ParamLLVMType
495 auto *ValueProfilingCallTy =
498 ValueProfilingCallTy);
500 Type *RangeParamTypes[] = {
501 #define VALUE_RANGE_PROF 1
502 #define VALUE_PROF_FUNC_PARAM(ParamType, ParamName, ParamLLVMType) ParamLLVMType
504 #undef VALUE_RANGE_PROF
506 auto *ValueRangeProfilingCallTy =
509 ValueRangeProfilingCallTy);
512 if (
Function *FunRes = dyn_cast<Function>(Res)) {
514 FunRes->addParamAttr(2, AK);
523 auto It = ProfileDataMap.find(Name);
524 if (It == ProfileDataMap.end()) {
525 PerFunctionProfileData
PD;
527 ProfileDataMap[
Name] =
PD;
528 }
else if (It->second.NumValueSites[ValueKind] <= Index)
529 It->second.NumValueSites[
ValueKind] = Index + 1;
534 auto It = ProfileDataMap.find(Name);
535 assert(It != ProfileDataMap.end() && It->second.DataVar &&
536 "value profiling detected in function with no counter incerement");
542 Index += It->second.NumValueSites[
Kind];
546 llvm::InstrProfValueKind::IPVK_MemOPSize);
550 Builder.CreateBitCast(DataVar, Builder.getInt8PtrTy()),
551 Builder.getInt32(Index)};
556 Builder.CreateBitCast(DataVar, Builder.getInt8PtrTy()),
557 Builder.getInt32(Index),
558 Builder.getInt64(MemOPSizeRangeStart),
559 Builder.getInt64(MemOPSizeRangeLast),
575 Value *Addr = Builder.CreateConstInBoundsGEP2_64(Counters, 0, Index);
576 Value *
Load = Builder.CreateLoad(Addr,
"pgocount");
577 auto *Count = Builder.CreateAdd(Load, Inc->
getStep());
578 auto *
Store = Builder.CreateStore(Count, Addr);
580 if (isCounterPromotionEnabled())
581 PromotionCandidates.emplace_back(cast<Instruction>(Load),
Store);
585 void InstrProfiling::lowerCoverageData(
GlobalVariable *CoverageNamesVar) {
591 assert(isa<GlobalVariable>(V) &&
"Missing reference to function name");
595 ReferencedNames.push_back(Name);
609 return (Prefix + Name).str();
613 return (Prefix + Name).str();
614 return (Prefix + Name +
"." +
Twine(FuncHash)).str();
621 !HasAvailableExternallyLinkage)
627 if (HasAvailableExternallyLinkage &&
679 auto It = ProfileDataMap.find(NamePtr);
680 PerFunctionProfileData
PD;
681 if (It != ProfileDataMap.end()) {
682 if (It->second.RegionCounters)
683 return It->second.RegionCounters;
692 Comdat *ProfileVarsComdat =
nullptr;
705 CounterPtr->setSection(
707 CounterPtr->setAlignment(8);
708 CounterPtr->setComdat(ProfileVarsComdat);
717 NS += PD.NumValueSites[
Kind];
726 ValuesVar->setSection(
728 ValuesVar->setAlignment(8);
729 ValuesVar->setComdat(ProfileVarsComdat);
738 Type *DataTypes[] = {
739 #define INSTR_PROF_DATA(Type, LLVMType, Name, Init) LLVMType,
748 Constant *Int16ArrayVals[IPVK_Last + 1];
753 #define INSTR_PROF_DATA(Type, LLVMType, Name, Init) Init,
761 Data->setAlignment(INSTR_PROF_DATA_ALIGNMENT);
762 Data->setComdat(ProfileVarsComdat);
764 PD.RegionCounters = CounterPtr;
766 ProfileDataMap[NamePtr] =
PD;
769 UsedVars.push_back(
Data);
775 ReferencedNames.push_back(NamePtr);
780 void InstrProfiling::emitVNodes() {
781 if (!ValueProfileStaticAlloc)
791 for (
auto &PD : ProfileDataMap) {
793 TotalNS += PD.second.NumValueSites[
Kind];
799 uint64_t NumCounters = TotalNS * NumCountersPerValueSite;
807 #define INSTR_PROF_MIN_VAL_COUNTS 10
812 Type *VNodeTypes[] = {
813 #define INSTR_PROF_VALUE_NODE(Type, LLVMType, Name, Init) LLVMType,
822 VNodesVar->setSection(
824 UsedVars.push_back(VNodesVar);
827 void InstrProfiling::emitNameData() {
828 std::string UncompressedData;
830 if (ReferencedNames.empty())
833 std::string CompressedNameStr;
835 DoNameCompression)) {
841 Ctx,
StringRef(CompressedNameStr),
false);
845 NamesSize = CompressedNameStr.size();
848 UsedVars.push_back(NamesVar);
850 for (
auto *NamePtr : ReferencedNames)
854 void InstrProfiling::emitRegistration() {
867 RegisterF->addFnAttr(Attribute::NoRedZone);
870 auto *RuntimeRegisterF =
876 if (
Data != NamesVar)
877 IRB.CreateCall(RuntimeRegisterF, IRB.CreateBitCast(
Data, VoidPtrTy));
880 Type *ParamTypes[] = {VoidPtrTy, Int64Ty};
881 auto *NamesRegisterTy =
883 auto *NamesRegisterF =
886 IRB.CreateCall(NamesRegisterF, {IRB.CreateBitCast(NamesVar, VoidPtrTy),
887 IRB.getInt64(NamesSize)});
893 void InstrProfiling::emitRuntimeHook() {
913 User->addFnAttr(Attribute::NoInline);
915 User->addFnAttr(Attribute::NoRedZone);
921 auto *Load = IRB.CreateLoad(Var);
925 UsedVars.push_back(
User);
928 void InstrProfiling::emitUses() {
929 if (!UsedVars.empty())
933 void InstrProfiling::emitInitialization() {
936 if (!InstrProfileOutput.
empty()) {
942 ProfileNameConst, INSTR_PROF_QUOTE(INSTR_PROF_PROFILE_NAME_VAR));
946 StringRef(INSTR_PROF_QUOTE(INSTR_PROF_PROFILE_NAME_VAR))));
960 F->addFnAttr(Attribute::NoInline);
962 F->addFnAttr(Attribute::NoRedZone);
967 IRB.CreateCall(RegisterF, {});
void setVisibility(VisibilityTypes V)
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
StringRef getInstrProfRuntimeHookVarUseFuncName()
Return the name of the compiler generated function that references the runtime hook variable...
LinkageTypes getLinkage() const
static Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true)
This method constructs a CDS and initializes it with a text string.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool endswith(StringRef Suffix) const
Check if this string ends with the given Suffix.
Helper class for SSA formation on a set of values defined in multiple blocks.
VisibilityTypes getVisibility() const
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
void dropAllReferences()
Drop all references to operands.
StringRef getInstrProfNameVarPrefix()
Return the name prefix of variables containing instrumented function names.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Constant * getOrInsertFunction(StringRef Name, FunctionType *T, AttributeList AttributeList)
Look up the specified function in the module symbol table.
StringRef getInstrProfRegFuncsName()
Return the name of function that registers all the per-function control data at program startup time ...
A Module instance is used to store all the information related to an LLVM module. ...
Maximum length of the test input libFuzzer tries to guess a good value based on the corpus and reports it always prefer smaller inputs during the corpus shuffle When libFuzzer itself reports a bug this exit code will be used If indicates the maximal total time in seconds to run the fuzzer minimizes the provided crash input Use with tries to cleanse the provided crash input to make it contain fewer original bytes Use with exact_artifact_path to specify the output Experimental Use value profile to guide fuzzing Number of jobs to run If min(jobs, NumberOfCpuCores()/2)\" is used.") FUZZER_FLAG_INT(reload
unsigned getNumOperands() const
#define INSTR_PROF_MIN_VAL_COUNTS
This class represents a function call, abstracting a target machine's calling convention.
bool canRenameComdatFunc(const Function &F, bool CheckAddressTaken=false)
Check if we can safely rename this Comdat function.
ConstantInt * getIndex() const
Like Internal, but omit from symbol table.
Externally visible function.
bool hasAvailableExternallyLinkage() const
const Function * getParent() const
Return the enclosing method, or null if none.
This file provides the interface for LLVM's PGO Instrumentation lowering pass.
std::string getInstrProfSectionName(InstrProfSectKind IPSK, Triple::ObjectFormatType OF, bool AddSegmentInfo=true)
Return the name of the profile section corresponding to IPSK.
An instruction for reading from memory.
static IntegerType * getInt64Ty(LLVMContext &C)
ModulePass * createInstrProfilingLegacyPass(const InstrProfOptions &Options=InstrProfOptions())
Insert frontend instrumentation based profiling.
LoopT * getLoopFor(const BlockT *BB) const
Return the inner most loop that BB lives in.
static IntegerType * getInt16Ty(LLVMContext &C)
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
StringRef getInstrProfValuesVarPrefix()
Return the name prefix of value profile variables.
const std::string & getTargetTriple() const
Get the target triple which is a string describing the target host.
ConstantInt * getHash() const
bool supportsCOMDAT() const
Tests wether the target supports comdat.
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
StringRef getName() const
Return a constant reference to the value's name.
iterator begin()
Instruction iterator methods.
cl::opt< unsigned > MemOPSizeLarge("memop-size-large", cl::desc("Set large value thresthold in memory intrinsic size profiling. ""Value of 0 disables the large value profiling."), cl::init(8192))
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
StringRef getInstrProfInitFuncName()
Return the name of the runtime initialization method that is generated by the compiler.
std::string toString(Error E)
Write all error messages (if any) in E to a string.
static Value * getPointerOperand(Instruction &Inst)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Frontend instrumentation based coverage lowering
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
StringRef getInstrProfDataVarPrefix()
Return the name prefix of variables containing per-function control data.
const Constant * stripPointerCasts() const
Instrumentation based profiling lowering pass.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs...ExtraArgs)
Get the result of an analysis pass for a given IR unit.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
ConstantInt * getIndex() const
void getExitingBlocks(SmallVectorImpl< BlockT * > &ExitingBlocks) const
Return all blocks inside the loop that have successors outside of the loop.
This file contains the simple types necessary to represent the attributes associated with functions a...
Error collectPGOFuncNameStrings(ArrayRef< std::string > NameStrs, bool doCompression, std::string &Result)
Given a vector of strings (function PGO names) NameStrs, the method generates a combined string Resul...
ObjectFormatType getObjectFormat() const
getFormat - Get the object format for this triple.
StringRef getCoverageUnusedNamesVarName()
Return the name of the internal variable recording the array of PGO name vars referenced by the cover...
ConstantInt * getNumCounters() const
void getExitBlocks(SmallVectorImpl< BlockT * > &ExitBlocks) const
Return all of the successor blocks of this loop.
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
StringRef getInstrProfNamesRegFuncName()
Return the name of the runtime interface that registers the PGO name strings.
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
Class to represent array types.
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
Attribute::AttrKind getExtAttrForI32Param(bool Signed=true) const
Returns extension attribute kind to be used for i32 parameters corresponding to C-level int or unsign...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
bool isIRPGOFlagSet(const Module *M)
Check if INSTR_PROF_RAW_VERSION_VAR is defined.
Function * getFunction(StringRef Name) const
Look up the specified function in the module symbol table.
static std::string getVarName(InstrProfIncrementInst *Inc, StringRef Prefix)
Get the name of a profiling variable for a particular function.
static Constant * getBitCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
GlobalVariable * getName() const
void getMemOPSizeRangeFromOption(StringRef Str, int64_t &RangeStart, int64_t &RangeLast)
bool needsComdatForCounter(const Function &F, const Module &M)
Check if we can use Comdat for profile variables.
Same, but only replaced by something equivalent.
initializer< Ty > init(const Ty &Val)
A set of analyses that are preserved following a run of a transformation pass.
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
static ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
BlockT * getLoopPreheader() const
If there is a preheader for this loop, return it.
static Constant * getOrInsertValueProfilingCall(Module &M, const TargetLibraryInfo &TLI, bool IsRange=false)
GlobalVariable * getName() const
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
StringRef getInstrProfValueProfFuncName()
Return the name profile runtime entry point to do value profiling for a given site.
This is an important base class in LLVM.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const_iterator getFirstInsertionPt() const
Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI i...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
StringRef getInstrProfNamesVarName()
Return the name of the variable holding the strings (possibly compressed) of all function's PGO names...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
void eraseFromParent()
eraseFromParent - This method unlinks 'this' from the containing module and deletes it...
Represent the analysis usage information of a pass.
static Type * getVoidTy(LLVMContext &C)
bool any_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
static bool shouldRecordFunctionAddr(Function *F)
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE,"Assign register bank of generic virtual registers", false, false) RegBankSelect
Value * getOperand(unsigned i) const
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
Value * getTargetValue() const
Frontend instrumentation based coverage false
static Constant * get(StructType *T, ArrayRef< Constant * > V)
INITIALIZE_PASS_BEGIN(InstrProfilingLegacyPass,"instrprof","Frontend instrumentation-based coverage lowering.", false, false) INITIALIZE_PASS_END(InstrProfilingLegacyPass
bool hasDedicatedExits() const
Return true if no exit block for the loop has a predecessor that is outside the loop.
Comdat * getOrInsertComdat(StringRef Name)
Return the Comdat in the module with the specified name.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
std::string InstrProfileOutput
static bool needsRuntimeRegistrationOfSectionRange(const Module &M)
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
Triple - Helper class for working with autoconf configuration names.
StringRef getInstrProfCountersVarPrefix()
Return the name prefix of profile counter variables.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
static StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
Provides information about what library functions are available for the current target.
A constant pointer value that points to null.
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
void appendToGlobalCtors(Module &M, Function *F, int Priority, Constant *Data=nullptr)
Append F to the list of global ctors of module M with the given Priority.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
void setLinkage(LinkageTypes LT)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
ConstantArray - Constant Array Declarations.
StringRef getInstrProfRuntimeHookVarName()
Return the name of the hook variable defined in profile runtime library.
StringRef getInstrProfRegFuncName()
Return the name of the runtime interface that registers per-function control data for one instrumente...
Options for the frontend instrumentation based profiling pass.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
static StringRef toStringRef(bool B)
Construct a string ref from a boolean.
This represents the llvm.instrprof_increment intrinsic.
static uint8_t Counters[N]
bool hasLinkOnceLinkage() const
bool hasAddressTaken(const User **=nullptr) const
hasAddressTaken - returns true if there are any uses of this function other than direct calls or invo...
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
static IntegerType * getInt32Ty(LLVMContext &C)
Represents a single loop in the control flow graph.
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
static ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Keep one copy of named function when linking (weak)
Rename collisions when linking (static functions).
bool hasLocalLinkage() const
SmallVector< LoopT *, 4 > getLoopsInPreorder()
Return all of the loops in the function in preorder across the loop nests, with siblings in forward p...
Analysis pass providing the TargetLibraryInfo.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef getInstrProfValueRangeProfFuncName()
Return the name profile runtime entry point to do value range profiling.
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
void appendToUsed(Module &M, ArrayRef< GlobalValue * > Values)
Adds global values to the llvm.used list.
StringRef getInstrProfVNodesVarName()
Return the name of value profile node array variables:
Lightweight error class with error context and mandatory checking.
static Comdat * getOrCreateProfileComdat(Module &M, Function &F, InstrProfIncrementInst *Inc)
StringRef - Represent a constant reference to a string, i.e.
A container for analyses that lazily runs them and caches their results.
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, const Twine &N="", Module *M=nullptr)
StringRef getInstrProfComdatPrefix()
Return the name prefix of the COMDAT group for instrumentation variables associated with a COMDAT fun...
ConstantInt * getValueKind() const
const TerminatorInst * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
This represents the llvm.instrprof_value_profile intrinsic.
static InstrProfIncrementInst * castToIncrementInst(Instruction *Instr)
void setSection(StringRef S)
Change the section for this global.
const BasicBlock * getParent() const
GlobalVariable * getGlobalVariable(StringRef Name) const
Look up the specified global variable in the module symbol table.
LLVMContext & getContext() const
Get the global data context.
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Adds the attribute to the indicated argument.
cl::opt< std::string > MemOPSizeRange("memop-size-range", cl::desc("Set the range of size in memory intrinsic calls to be profiled ""precisely, in a format of <start_val>:<end_val>"), cl::init(""))