56 #define DEBUG_TYPE "instrprof" 62 cl::desc(
"Set the range of size in memory intrinsic calls to be profiled " 63 "precisely, in a format of <start_val>:<end_val>"),
69 cl::desc(
"Set large value thresthold in memory intrinsic size profiling. " 70 "Value of 0 disables the large value profiling."),
76 cl::desc(
"Enable name string compression"),
80 "hash-based-counter-split",
81 cl::desc(
"Rename counter variable of a comdat function based on cfg hash"),
86 cl::desc(
"Do static counter allocation for value profiler"),
90 "vp-counters-per-site",
91 cl::desc(
"The average number of profile counters allocated " 92 "per value profiling site."),
101 cl::desc(
"Make all profile counter updates atomic (for testing only)"),
106 cl::desc(
"Do counter update using atomic fetch add " 107 " for promoted counters only"),
116 cl::desc(
"Do counter register promotion"),
120 cl::desc(
"Max number counter promotions per loop to avoid" 121 " increasing register pressure too much"));
126 cl::desc(
"Max number of allowed counter promotions"));
130 cl::desc(
"The max number of exiting blocks of a loop to allow " 131 " speculative counter promotion"));
135 cl::desc(
"When the option is false, if the target block is in a loop, " 136 "the promotion will be disallowed unless the promoted counter " 137 " update can be further/iteratively promoted into an acyclic " 142 cl::desc(
"Allow counter promotion across the whole loop nest."));
144 class InstrProfilingLegacyPass :
public ModulePass {
150 InstrProfilingLegacyPass() :
ModulePass(ID) {}
155 return "Frontend instrumentation-based coverage lowering";
158 bool runOnModule(
Module &M)
override {
159 return InstrProf.
run(M, getAnalysis<TargetLibraryInfoWrapperPass>().getTLI());
177 PGOCounterPromoterHelper(
184 InsertPts(InsertPts), LoopToCandidates(LoopToCands), LI(LI) {
186 assert(isa<StoreInst>(S));
187 SSA.AddAvailableValue(PH,
Init);
190 void doExtraRewritesBeforeFinalDeletion()
const override {
191 for (
unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) {
197 Value *LiveInValue =
SSA.GetValueInMiddleOfBlock(ExitBlock);
200 if (AtomicCounterUpdatePromoted)
206 LoadInst *OldVal = Builder.CreateLoad(Addr,
"pgocount.promoted");
207 auto *NewVal = Builder.CreateAdd(OldVal, LiveInValue);
208 auto *NewStore = Builder.CreateStore(NewVal, Addr);
211 if (IterativeCounterPromotion) {
212 auto *TargetLoop = LI.getLoopFor(ExitBlock);
214 LoopToCandidates[TargetLoop].emplace_back(OldVal, NewStore);
231 class PGOCounterPromoter {
236 : LoopToCandidates(LoopToCands), ExitBlocks(), InsertPts(), L(CurLoop),
241 L.getExitBlocks(LoopExitBlocks);
243 for (
BasicBlock *ExitBlock : LoopExitBlocks) {
244 if (BlockSet.
insert(ExitBlock).second) {
245 ExitBlocks.push_back(ExitBlock);
251 bool run(int64_t *NumPromoted) {
253 if (ExitBlocks.size() == 0)
255 unsigned MaxProm = getMaxNumOfPromotionsInLoop(&L);
259 unsigned Promoted = 0;
260 for (
auto &Cand : LoopToCandidates[&L]) {
266 PGOCounterPromoterHelper Promoter(Cand.first, Cand.second,
SSA, InitVal,
267 L.getLoopPreheader(), ExitBlocks,
268 InsertPts, LoopToCandidates, LI);
271 if (Promoted >= MaxProm)
275 if (MaxNumOfPromotions != -1 && *NumPromoted >= MaxNumOfPromotions)
279 LLVM_DEBUG(
dbgs() << Promoted <<
" counters promoted for loop (depth=" 280 << L.getLoopDepth() <<
")\n");
281 return Promoted != 0;
285 bool allowSpeculativeCounterPromotion(
Loop *LP) {
287 L.getExitingBlocks(ExitingBlocks);
289 if (ExitingBlocks.
size() == 1)
291 if (ExitingBlocks.
size() > SpeculativeCounterPromotionMaxExiting)
297 unsigned getMaxNumOfPromotionsInLoop(
Loop *LP) {
316 if (ExitingBlocks.
size() == 1)
317 return MaxNumOfPromotionsPerLoop;
319 if (ExitingBlocks.
size() > SpeculativeCounterPromotionMaxExiting)
323 if (SpeculativeCounterPromotionToLoop)
324 return MaxNumOfPromotionsPerLoop;
327 unsigned MaxProm = MaxNumOfPromotionsPerLoop;
328 for (
auto *TargetBlock : LoopExitBlocks) {
329 auto *TargetLoop = LI.
getLoopFor(TargetBlock);
332 unsigned MaxPromForTarget = getMaxNumOfPromotionsInLoop(TargetLoop);
333 unsigned PendingCandsInTarget = LoopToCandidates[TargetLoop].size();
335 std::min(MaxProm,
std::max(MaxPromForTarget, PendingCandsInTarget) -
336 PendingCandsInTarget);
360 InstrProfilingLegacyPass,
"instrprof",
361 "Frontend instrumentation-based coverage lowering.",
false,
false)
364 InstrProfilingLegacyPass,
"instrprof",
365 "Frontend instrumentation-based coverage lowering.",
false,
false)
369 return new InstrProfilingLegacyPass(Options);
379 bool InstrProfiling::lowerIntrinsics(
Function *
F) {
380 bool MadeChange =
false;
381 PromotionCandidates.clear();
383 for (
auto I = BB.begin(),
E = BB.end();
I !=
E;) {
389 }
else if (
auto *Ind = dyn_cast<InstrProfValueProfileInst>(Instr)) {
390 lowerValueProfileInst(Ind);
399 promoteCounterLoadStores(F);
403 bool InstrProfiling::isCounterPromotionEnabled()
const {
404 if (DoCounterPromotion.getNumOccurrences() > 0)
405 return DoCounterPromotion;
407 return Options.DoCounterPromotion;
410 void InstrProfiling::promoteCounterLoadStores(
Function *F) {
411 if (!isCounterPromotionEnabled())
418 for (
const auto &
LoadStore : PromotionCandidates) {
425 LoopPromotionCandidates[ParentLoop].emplace_back(CounterLoad, CounterStore);
433 PGOCounterPromoter Promoter(LoopPromotionCandidates, *
Loop, LI);
434 Promoter.run(&TotalCountersPromoted);
460 ProfileDataMap.clear();
467 bool MadeChange = emitRuntimeHook();
481 for (
auto I = BB.begin(),
E = BB.end();
I !=
E;
I++)
482 if (
auto *Ind = dyn_cast<InstrProfValueProfileInst>(
I))
483 computeNumValueSiteCounts(Ind);
484 else if (FirstProfIncInst ==
nullptr)
489 if (FirstProfIncInst !=
nullptr)
490 static_cast<void>(getOrCreateRegionCounters(FirstProfIncInst));
496 if (CoverageNamesVar) {
497 lowerCoverageData(CoverageNamesVar);
508 emitInitialization();
514 bool IsRange =
false) {
520 Type *ParamTypes[] = {
521 #define VALUE_PROF_FUNC_PARAM(ParamType, ParamName, ParamLLVMType) ParamLLVMType 524 auto *ValueProfilingCallTy =
527 ValueProfilingCallTy);
529 Type *RangeParamTypes[] = {
530 #define VALUE_RANGE_PROF 1 531 #define VALUE_PROF_FUNC_PARAM(ParamType, ParamName, ParamLLVMType) ParamLLVMType 533 #undef VALUE_RANGE_PROF 535 auto *ValueRangeProfilingCallTy =
538 ValueRangeProfilingCallTy);
541 if (
Function *FunRes = dyn_cast<Function>(Res)) {
543 FunRes->addParamAttr(2, AK);
552 auto It = ProfileDataMap.find(Name);
553 if (It == ProfileDataMap.end()) {
554 PerFunctionProfileData
PD;
556 ProfileDataMap[
Name] =
PD;
557 }
else if (It->second.NumValueSites[ValueKind] <= Index)
558 It->second.NumValueSites[
ValueKind] = Index + 1;
563 auto It = ProfileDataMap.find(Name);
564 assert(It != ProfileDataMap.end() && It->second.DataVar &&
565 "value profiling detected in function with no counter incerement");
571 Index += It->second.NumValueSites[
Kind];
575 llvm::InstrProfValueKind::IPVK_MemOPSize);
579 Builder.CreateBitCast(DataVar, Builder.getInt8PtrTy()),
580 Builder.getInt32(Index)};
585 Builder.CreateBitCast(DataVar, Builder.getInt8PtrTy()),
586 Builder.getInt32(Index),
587 Builder.getInt64(MemOPSizeRangeStart),
588 Builder.getInt64(MemOPSizeRangeLast),
593 if (
auto AK = TLI->getExtAttrForI32Param(
false))
606 if (Options.Atomic || AtomicCounterUpdateAll) {
613 if (isCounterPromotionEnabled())
614 PromotionCandidates.emplace_back(cast<Instruction>(Load),
Store);
619 void InstrProfiling::lowerCoverageData(
GlobalVariable *CoverageNamesVar) {
625 assert(isa<GlobalVariable>(V) &&
"Missing reference to function name");
629 ReferencedNames.push_back(Name);
643 return (Prefix + Name).str();
647 return (Prefix + Name).str();
648 return (Prefix + Name +
"." +
Twine(FuncHash)).str();
655 !HasAvailableExternallyLinkage)
661 if (HasAvailableExternallyLinkage &&
715 auto It = ProfileDataMap.find(NamePtr);
716 PerFunctionProfileData
PD;
717 if (It != ProfileDataMap.end()) {
718 if (It->second.RegionCounters)
719 return It->second.RegionCounters;
728 Comdat *ProfileVarsComdat =
nullptr;
741 CounterPtr->setSection(
743 CounterPtr->setAlignment(8);
744 CounterPtr->setComdat(ProfileVarsComdat);
753 NS += PD.NumValueSites[
Kind];
762 ValuesVar->setSection(
764 ValuesVar->setAlignment(8);
765 ValuesVar->setComdat(ProfileVarsComdat);
774 Type *DataTypes[] = {
775 #define INSTR_PROF_DATA(Type, LLVMType, Name, Init) LLVMType, 784 Constant *Int16ArrayVals[IPVK_Last + 1];
789 #define INSTR_PROF_DATA(Type, LLVMType, Name, Init) Init, 797 Data->setAlignment(INSTR_PROF_DATA_ALIGNMENT);
798 Data->setComdat(ProfileVarsComdat);
800 PD.RegionCounters = CounterPtr;
802 ProfileDataMap[NamePtr] =
PD;
805 UsedVars.push_back(
Data);
811 ReferencedNames.push_back(NamePtr);
816 void InstrProfiling::emitVNodes() {
817 if (!ValueProfileStaticAlloc)
827 for (
auto &
PD : ProfileDataMap) {
829 TotalNS +=
PD.second.NumValueSites[
Kind];
835 uint64_t NumCounters = TotalNS * NumCountersPerValueSite;
843 #define INSTR_PROF_MIN_VAL_COUNTS 10 848 Type *VNodeTypes[] = {
849 #define INSTR_PROF_VALUE_NODE(Type, LLVMType, Name, Init) LLVMType, 858 VNodesVar->setSection(
860 UsedVars.push_back(VNodesVar);
863 void InstrProfiling::emitNameData() {
864 std::string UncompressedData;
866 if (ReferencedNames.empty())
869 std::string CompressedNameStr;
871 DoNameCompression)) {
877 Ctx,
StringRef(CompressedNameStr),
false);
881 NamesSize = CompressedNameStr.size();
884 UsedVars.push_back(NamesVar);
886 for (
auto *NamePtr : ReferencedNames)
887 NamePtr->eraseFromParent();
890 void InstrProfiling::emitRegistration() {
902 if (Options.NoRedZone)
906 auto *RuntimeRegisterF =
912 if (
Data != NamesVar && !isa<Function>(
Data))
916 Type *ParamTypes[] = {VoidPtrTy, Int64Ty};
917 auto *NamesRegisterTy =
919 auto *NamesRegisterF =
929 bool InstrProfiling::emitRuntimeHook() {
950 if (Options.NoRedZone)
961 UsedVars.push_back(
User);
965 void InstrProfiling::emitUses() {
966 if (!UsedVars.empty())
970 void InstrProfiling::emitInitialization() {
971 StringRef InstrProfileOutput = Options.InstrProfileOutput;
973 if (!InstrProfileOutput.
empty()) {
979 ProfileNameConst, INSTR_PROF_QUOTE(INSTR_PROF_PROFILE_NAME_VAR));
980 if (TT.supportsCOMDAT()) {
983 StringRef(INSTR_PROF_QUOTE(INSTR_PROF_PROFILE_NAME_VAR))));
998 if (Options.NoRedZone)
void setVisibility(VisibilityTypes V)
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(""))
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...
const std::string & getTargetTriple() const
Get the target triple which is a string describing the target host.
static Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true)
This method constructs a CDS and initializes it with a text string.
bool hasLocalLinkage() const
Helper class for SSA formation on a set of values defined in multiple blocks.
Value * getPointerOperand(Value *V)
A helper function that returns the pointer operand of a load, store or GEP instruction.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
ConstantInt * getIndex() const
void dropAllReferences()
Drop all references to operands.
StringRef getInstrProfNameVarPrefix()
Return the name prefix of variables containing instrumented function names.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
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))
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 ...
LoadInst * CreateLoad(Type *Ty, Value *Ptr, const char *Name)
Provided to resolve 'CreateLoad(Ty, Ptr, "...")' correctly, instead of converting the string to 'bool...
A Module instance is used to store all the information related to an LLVM module. ...
bool hasDedicatedExits() const
Return true if no exit block for the loop has a predecessor that is outside the loop.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
static bool containsProfilingIntrinsics(Module &M)
Check if the module contains uses of any profiling intrinsics.
#define INSTR_PROF_MIN_VAL_COUNTS
This class represents a function call, abstracting a target machine's calling convention.
bool hasAvailableExternallyLinkage() const
bool canRenameComdatFunc(const Function &F, bool CheckAddressTaken=false)
Check if we can safely rename this Comdat function.
BlockT * getLoopPreheader() const
If there is a preheader for this loop, return it.
const GlobalVariable * getNamedGlobal(StringRef Name) const
Return the global variable in the module with the specified name, of arbitrary type.
Like Internal, but omit from symbol table.
Externally visible function.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
GlobalVariable * getGlobalVariable(StringRef Name) const
Look up the specified global variable in the module symbol table.
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.
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
static IntegerType * getInt16Ty(LLVMContext &C)
StringRef getInstrProfValuesVarPrefix()
Return the name prefix of value profile variables.
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
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 bool endswith(StringRef Suffix) const
Check if this string ends with the given Suffix.
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
StringRef getInstrProfInitFuncName()
Return the name of the runtime initialization method that is generated by the compiler.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
std::string toString(Error E)
Write all error messages (if any) in E to a string.
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LoopT * getLoopFor(const BlockT *BB) const
Return the inner most loop that BB lives in.
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.
LLVMContext & getContext() const
Get the global data context.
Instrumentation based profiling lowering pass.
ReturnInst * CreateRet(Value *V)
Create a 'ret <val>' instruction.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
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...
Value * CreateAdd(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
StringRef getCoverageUnusedNamesVarName()
Return the name of the internal variable recording the array of PGO name vars referenced by the cover...
static StructType * get(LLVMContext &Context, ArrayRef< Type *> Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
StringRef getInstrProfNamesRegFuncName()
Return the name of the runtime interface that registers the PGO name strings.
StoreInst * CreateStore(Value *Val, Value *Ptr, bool isVolatile=false)
void getExitBlocks(SmallVectorImpl< BlockT *> &ExitBlocks) const
Return all of the successor blocks of this loop.
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
Type * getType() const
All values are typed, get the type of this value.
void appendToUsed(Module &M, ArrayRef< GlobalValue *> Values)
Adds global values to the llvm.used list.
Class to represent array types.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
LinkageTypes getLinkage() const
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
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).
bool hasLinkOnceLinkage() const
GlobalVariable * getName() const
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
Value * getOperand(unsigned i) const
ConstantInt * getNumCounters() const
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.
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)
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)
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
A set of analyses that are preserved following a run of a transformation pass.
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
const_iterator getFirstInsertionPt() const
Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI i...
static ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
VisibilityTypes getVisibility() const
ConstantInt * getIndex() const
static Constant * getOrInsertValueProfilingCall(Module &M, const TargetLibraryInfo &TLI, bool IsRange=false)
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.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
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...
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)
static FunctionType * get(Type *Result, ArrayRef< Type *> Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
static Constant * get(StructType *T, ArrayRef< Constant *> V)
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
ConstantInt * getInt64(uint64_t C)
Get a constant 64-bit value.
AtomicRMWInst * CreateAtomicRMW(AtomicRMWInst::BinOp Op, Value *Ptr, Value *Val, AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System)
void getExitingBlocks(SmallVectorImpl< BlockT *> &ExitingBlocks) const
Return all blocks inside the loop that have successors outside of the loop.
StringRef toStringRef(bool B)
Construct a string ref from a boolean.
const Constant * stripPointerCasts() const
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.
static bool needsRuntimeRegistrationOfSectionRange(const Module &M)
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
Triple - Helper class for working with autoconf configuration names.
StringRef getInstrProfCountersVarPrefix()
Return the name prefix of profile counter variables.
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Adds the attribute to the indicated argument.
unsigned getNumOperands() const
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
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.
Provides information about what library functions are available for the current target.
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.
Function * getFunction(StringRef Name) const
Look up the specified function in the module symbol table.
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.
This represents the llvm.instrprof_increment intrinsic.
ReturnInst * CreateRetVoid()
Create a 'ret void' instruction.
static IntegerType * getInt32Ty(LLVMContext &C)
Value * getTargetValue() const
Represents a single loop in the control flow graph.
ConstantInt * getHash() const
StringRef getName() const
Return a constant reference to the value's name.
const Function * getParent() const
Return the enclosing method, or null if none.
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).
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value *> Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)
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.
bool hasAddressTaken(const User **=nullptr) const
hasAddressTaken - returns true if there are any uses of this function other than direct calls or invo...
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.
StringRef getInstrProfVNodesVarName()
Return the name of value profile node array variables:
GlobalVariable * getName() const
Lightweight error class with error context and mandatory checking.
ConstantInt * getValueKind() const
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.
StringRef getInstrProfComdatPrefix()
Return the name prefix of the COMDAT group for instrumentation variables associated with a COMDAT fun...
static bool lowerIntrinsics(Module &M)
This represents the llvm.instrprof_value_profile intrinsic.
static InstrProfIncrementInst * castToIncrementInst(Instruction *Instr)
void setSection(StringRef S)
Change the section for this global.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Value * CreateConstInBoundsGEP2_64(Type *Ty, Value *Ptr, uint64_t Idx0, uint64_t Idx1, const Twine &Name="")
INITIALIZE_PASS_BEGIN(InstrProfilingLegacyPass, "instrprof", "Frontend instrumentation-based coverage lowering.", false, false) INITIALIZE_PASS_END(InstrProfilingLegacyPass
const BasicBlock * getParent() const