LLVM 24.0.0git
ProfDataUtils.cpp
Go to the documentation of this file.
1//===- ProfDataUtils.cpp - Utility functions for MD_prof Metadata ---------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements utilities for working with Profiling Metadata.
10//
11//===----------------------------------------------------------------------===//
12
14#include "IROptions.h"
15
16#include "llvm/ADT/STLExtras.h"
19#include "llvm/IR/Constants.h"
20#include "llvm/IR/Function.h"
22#include "llvm/IR/LLVMContext.h"
23#include "llvm/IR/MDBuilder.h"
24#include "llvm/IR/Metadata.h"
26
27using namespace llvm;
28
29namespace llvm {
31}
32
33// MD_prof nodes have the following layout
34//
35// In general:
36// { String name, Array of i32 }
37//
38// In terms of Types:
39// { MDString, [i32, i32, ...]}
40//
41// Concretely for Branch Weights
42// { "branch_weights", [i32 1, i32 10000]}
43//
44// We maintain some constants here to ensure that we access the branch weights
45// correctly, and can change the behavior in the future if the layout changes
46
47// the minimum number of operands for MD_prof nodes with branch weights
48static constexpr unsigned MinBWOps = 3;
49
50// the minimum number of operands for MD_prof nodes with value profiles
51static constexpr unsigned MinVPOps = 5;
52
53// We may want to add support for other MD_prof types, so provide an abstraction
54// for checking the metadata type.
55static bool isTargetMD(const MDNode *ProfData, const char *Name,
56 unsigned MinOps) {
57 // TODO: This routine may be simplified if MD_prof used an enum instead of a
58 // string to differentiate the types of MD_prof nodes.
59 if (!ProfData || !Name || MinOps < 2)
60 return false;
61
62 unsigned NOps = ProfData->getNumOperands();
63 if (NOps < MinOps)
64 return false;
65
66 auto *ProfDataName = dyn_cast<MDString>(ProfData->getOperand(0));
67 if (!ProfDataName)
68 return false;
69
70 return ProfDataName->getString() == Name;
71}
72
73template <typename T,
74 typename = typename std::enable_if<std::is_arithmetic_v<T>>>
75static void extractFromBranchWeightMD(const MDNode *ProfileData,
76 SmallVectorImpl<T> &Weights) {
77 assert(isBranchWeightMD(ProfileData) && "wrong metadata");
78
79 unsigned NOps = ProfileData->getNumOperands();
80 unsigned WeightsIdx = getBranchWeightOffset(ProfileData);
81 assert(WeightsIdx < NOps && "Weights Index must be less than NOps.");
82 Weights.resize(NOps - WeightsIdx);
83
84 for (unsigned Idx = WeightsIdx, E = NOps; Idx != E; ++Idx) {
85 ConstantInt *Weight =
87 assert(Weight && "Malformed branch_weight in MD_prof node");
88 assert(Weight->getValue().getActiveBits() <= (sizeof(T) * 8) &&
89 "Too many bits for MD_prof branch_weight");
90 Weights[Idx - WeightsIdx] = Weight->getZExtValue();
91 }
92}
93
94/// Push the weights right to fit in uint32_t.
97 Ret.reserve(Weights.size());
98 uint64_t Max = *llvm::max_element(Weights);
99 if (Max > UINT_MAX) {
100 unsigned Offset = 32 - llvm::countl_zero(Max);
101 for (const uint64_t &Value : Weights)
102 Ret.push_back(static_cast<uint32_t>(Value >> Offset));
103 } else {
104 append_range(Ret, Weights);
105 }
106 return Ret;
107}
108
109// This option is mainly used when constructing the pass pipeline, but needs to
110// be defined here so that it can also control all zero branch weight elision
111// and avoid layering issues.
112namespace llvm {
114 "enable-profcheck-in-pipeline", cl::init(false),
115 cl::desc("Adds profile verification to the pipeline, erroring if profile "
116 "information is dropped."));
117} // namespace llvm
118const char *MDProfLabels::BranchWeights = "branch_weights";
119const char *MDProfLabels::ExpectedBranchWeights = "expected";
120const char *MDProfLabels::ValueProfile = "VP";
121const char *MDProfLabels::FunctionEntryCount = "function_entry_count";
122const char *MDProfLabels::UnknownBranchWeightsMarker = "unknown";
123const char *llvm::LLVMLoopEstimatedTripCount = "llvm.loop.estimated_trip_count";
124
126 return I.hasMetadata(LLVMContext::MD_prof);
127}
128
129bool llvm::isBranchWeightMD(const MDNode *ProfileData) {
130 return isTargetMD(ProfileData, MDProfLabels::BranchWeights, MinBWOps);
131}
132
133bool llvm::isValueProfileMD(const MDNode *ProfileData) {
134 return isTargetMD(ProfileData, MDProfLabels::ValueProfile, MinVPOps);
135}
136
138 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof);
139 return isBranchWeightMD(ProfileData);
140}
141
142static bool hasCountTypeMD(const Instruction &I) {
143 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof);
144 // Value profiles record count-type information.
145 if (isValueProfileMD(ProfileData))
146 return true;
147 // Conservatively assume non CallBase instruction only get taken/not-taken
148 // branch probability, so not interpret them as count.
149 return isa<CallBase>(I) && !isBranchWeightMD(ProfileData);
150}
151
155
157 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof);
158 return hasBranchWeightOrigin(ProfileData);
159}
160
161bool llvm::hasBranchWeightOrigin(const MDNode *ProfileData) {
162 if (!isBranchWeightMD(ProfileData))
163 return false;
164 auto *ProfDataName = dyn_cast<MDString>(ProfileData->getOperand(1));
165 // NOTE: if we ever have more types of branch weight provenance,
166 // we need to check the string value is "expected". For now, we
167 // supply a more generic API, and avoid the spurious comparisons.
168 assert(ProfDataName == nullptr ||
169 ProfDataName->getString() == MDProfLabels::ExpectedBranchWeights);
170 return ProfDataName != nullptr;
171}
172
173unsigned llvm::getBranchWeightOffset(const MDNode *ProfileData) {
174 return hasBranchWeightOrigin(ProfileData) ? 2 : 1;
175}
176
177unsigned llvm::getNumBranchWeights(const MDNode &ProfileData) {
178 return ProfileData.getNumOperands() - getBranchWeightOffset(&ProfileData);
179}
180
182 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof);
183 if (!isBranchWeightMD(ProfileData))
184 return nullptr;
185 return ProfileData;
186}
187
189 auto *ProfileData = getBranchWeightMDNode(I);
190 if (ProfileData && getNumBranchWeights(*ProfileData) == I.getNumSuccessors())
191 return ProfileData;
192 return nullptr;
193}
194
196 SmallVectorImpl<uint32_t> &Weights) {
197 extractFromBranchWeightMD(ProfileData, Weights);
198}
199
201 SmallVectorImpl<uint64_t> &Weights) {
202 extractFromBranchWeightMD(ProfileData, Weights);
203}
204
205bool llvm::extractBranchWeights(const MDNode *ProfileData,
206 SmallVectorImpl<uint32_t> &Weights) {
207 if (!isBranchWeightMD(ProfileData))
208 return false;
209 extractFromBranchWeightMD(ProfileData, Weights);
210 return true;
211}
212
214 SmallVectorImpl<uint32_t> &Weights) {
215 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof);
216 return extractBranchWeights(ProfileData, Weights);
217}
218
219bool llvm::extractBranchWeights(const Instruction &I, uint64_t &TrueVal,
220 uint64_t &FalseVal) {
222 "Looking for branch weights on something besides CondBr or Select");
223
225 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof);
226 if (!extractBranchWeights(ProfileData, Weights))
227 return false;
228
229 if (Weights.size() > 2)
230 return false;
231
232 TrueVal = Weights[0];
233 FalseVal = Weights[1];
234 return true;
235}
236
237bool llvm::extractProfTotalWeight(const MDNode *ProfileData,
238 uint64_t &TotalVal) {
239 TotalVal = 0;
240 if (!ProfileData)
241 return false;
242
243 auto *ProfDataName = dyn_cast<MDString>(ProfileData->getOperand(0));
244 if (!ProfDataName)
245 return false;
246
247 if (ProfDataName->getString() == MDProfLabels::BranchWeights) {
248 unsigned Offset = getBranchWeightOffset(ProfileData);
249 for (unsigned Idx = Offset; Idx < ProfileData->getNumOperands(); ++Idx) {
250 auto *V = mdconst::extract<ConstantInt>(ProfileData->getOperand(Idx));
251 TotalVal += V->getValue().getZExtValue();
252 }
253 return true;
254 }
255
256 if (ProfDataName->getString() == MDProfLabels::ValueProfile &&
257 ProfileData->getNumOperands() > 3) {
258 TotalVal = mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand(2))
259 ->getValue()
260 .getZExtValue();
261 return true;
262 }
263 return false;
264}
265
266bool llvm::extractProfTotalWeight(const Instruction &I, uint64_t &TotalVal) {
267 return extractProfTotalWeight(I.getMetadata(LLVMContext::MD_prof), TotalVal);
268}
269
272 MDBuilder MDB(I.getContext());
273 I.setMetadata(
274 LLVMContext::MD_prof,
275 MDNode::get(I.getContext(),
276 {MDB.createString(MDProfLabels::UnknownBranchWeightsMarker),
277 MDB.createString(PassName)}));
278}
279
282 const Function *F) {
283 F = F ? F : I.getFunction();
284 assert(F && "Either pass a instruction attached to a Function, or explicitly "
285 "pass the Function that it will be attached to");
286 if (std::optional<uint64_t> EC = F->getEntryCount(); EC && *EC > 0)
288}
289
292 if (std::optional<uint64_t> EC = F.getEntryCount(); !EC || *EC == 0)
293 return nullptr;
294 MDBuilder MDB(F.getContext());
295 return MDNode::get(
296 F.getContext(),
297 {MDB.createString(MDProfLabels::UnknownBranchWeightsMarker),
298 MDB.createString(PassName)});
299}
300
303 MDBuilder MDB(F.getContext());
304 F.setMetadata(
305 LLVMContext::MD_prof,
306 MDNode::get(F.getContext(),
307 {MDB.createString(MDProfLabels::UnknownBranchWeightsMarker),
308 MDB.createString(PassName)}));
309}
310
312 if (MD.getNumOperands() != 2)
313 return false;
315}
316
318 auto *MD = I.getMetadata(LLVMContext::MD_prof);
319 if (!MD)
320 return false;
322}
323
325 bool IsExpected, bool ElideAllZero) {
326 if ((getIROptions(I.getContext()).elide_all_zero_branch_weights &&
327 !EnableProfcheckInPipeline && ElideAllZero) &&
328 llvm::all_of(Weights, equal_to(0))) {
329 I.setMetadata(LLVMContext::MD_prof, nullptr);
330 return;
331 }
332
333 MDBuilder MDB(I.getContext());
334 MDNode *BranchWeights = MDB.createBranchWeights(Weights, IsExpected);
335 I.setMetadata(LLVMContext::MD_prof, BranchWeights);
336}
337
339 bool IsExpected, bool ElideAllZero) {
340 setBranchWeights(I, fitWeights(Weights), IsExpected, ElideAllZero);
341}
342
345 std::optional<uint64_t> KnownMaxCount) {
346 uint64_t MaxCount = KnownMaxCount.has_value() ? KnownMaxCount.value()
347 : *llvm::max_element(Weights);
348 assert(MaxCount > 0 && "Bad max count");
349 uint64_t Scale = calculateCountScale(MaxCount);
350 SmallVector<uint32_t> DownscaledWeights;
351 for (const auto &ECI : Weights)
352 DownscaledWeights.push_back(scaleBranchCount(ECI, Scale));
353 return DownscaledWeights;
354}
355
356void llvm::scaleProfData(Instruction &I, uint64_t S, uint64_t T) {
357 assert(T != 0 && "Caller should guarantee");
358 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof);
359 if (ProfileData == nullptr)
360 return;
361
362 auto *ProfDataName = dyn_cast<MDString>(ProfileData->getOperand(0));
363 if (!ProfDataName ||
364 (ProfDataName->getString() != MDProfLabels::BranchWeights &&
365 ProfDataName->getString() != MDProfLabels::ValueProfile))
366 return;
367
368 if (!hasCountTypeMD(I))
369 return;
370
371 LLVMContext &C = I.getContext();
372
373 MDBuilder MDB(C);
375 Vals.push_back(ProfileData->getOperand(0));
376 APInt APS(128, S), APT(128, T);
377 if (ProfDataName->getString() == MDProfLabels::BranchWeights &&
378 ProfileData->getNumOperands() > 0) {
379 // Using APInt::div may be expensive, but most cases should fit 64 bits.
380 APInt Val(128,
382 ProfileData->getOperand(getBranchWeightOffset(ProfileData)))
383 ->getValue()
384 .getZExtValue());
385 Val *= APS;
386 Vals.push_back(MDB.createConstant(ConstantInt::get(
387 Type::getInt32Ty(C), Val.udiv(APT).getLimitedValue(UINT32_MAX))));
388 } else if (ProfDataName->getString() == MDProfLabels::ValueProfile)
389 for (unsigned Idx = 1; Idx < ProfileData->getNumOperands(); Idx += 2) {
390 // The first value is the key of the value profile, which will not change.
391 Vals.push_back(ProfileData->getOperand(Idx));
392 uint64_t Count =
393 mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand(Idx + 1))
394 ->getValue()
395 .getZExtValue();
396 // Don't scale the magic number.
397 if (Count == NOMORE_ICP_MAGICNUM) {
398 Vals.push_back(ProfileData->getOperand(Idx + 1));
399 continue;
400 }
401 // Using APInt::div may be expensive, but most cases should fit 64 bits.
402 APInt Val(128, Count);
403 Val *= APS;
404 Vals.push_back(MDB.createConstant(ConstantInt::get(
405 Type::getInt64Ty(C), Val.udiv(APT).getLimitedValue())));
406 }
407 I.setMetadata(LLVMContext::MD_prof, MDNode::get(C, Vals));
408}
409
411 Value *V, llvm::function_ref<void(Instruction *)> setMetadataCallback) {
413 if (Instruction *Inst = dyn_cast<Instruction>(V)) {
414 setMetadataCallback(Inst);
415 }
416 }
417}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static constexpr Value * getValue(Ty &ValueOrUse)
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
This file contains the declarations for metadata subclasses.
#define T
static constexpr unsigned MinVPOps
static bool isTargetMD(const MDNode *ProfData, const char *Name, unsigned MinOps)
static void extractFromBranchWeightMD(const MDNode *ProfileData, SmallVectorImpl< T > &Weights)
static bool hasCountTypeMD(const Instruction &I)
static constexpr unsigned MinBWOps
This file contains the declarations for profiling metadata utility functions.
This file contains some templates that are useful if you are working with the STL at all.
This file defines the SmallVector class.
static const char PassName[]
Class for arbitrary precision integers.
Definition APInt.h:78
LLVM_ABI APInt udiv(const APInt &RHS) const
Unsigned division operation.
Definition APInt.cpp:1602
unsigned getActiveBits() const
Compute the number of active bits in the value.
Definition APInt.h:1532
uint64_t getLimitedValue(uint64_t Limit=UINT64_MAX) const
If this value is smaller than the specified limit, return it, otherwise return the limit value.
Definition APInt.h:471
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
size_t size() const
Get the array size.
Definition ArrayRef.h:141
This is the shared class of boolean and integer constants.
Definition Constants.h:87
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
Definition Constants.h:168
const APInt & getValue() const
Return the constant as an APInt value reference.
Definition Constants.h:159
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:76
LLVM_ABI ConstantAsMetadata * createConstant(Constant *C)
Return the given constant as metadata.
Definition MDBuilder.cpp:25
LLVM_ABI MDNode * createBranchWeights(uint32_t TrueWeight, uint32_t FalseWeight, bool IsExpected=false)
Return metadata containing two branch weights.
Definition MDBuilder.cpp:38
Metadata node.
Definition Metadata.h:1081
const MDOperand & getOperand(unsigned I) const
Definition Metadata.h:1437
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition Metadata.h:1579
unsigned getNumOperands() const
Return number of MDNode operands.
Definition Metadata.h:1443
bool equalsStr(StringRef Str) const
Definition Metadata.h:924
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void reserve(size_type N)
void resize(size_type N)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
static LLVM_ABI IntegerType * getInt64Ty(LLVMContext &C)
Definition Type.cpp:300
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
Definition Type.cpp:299
LLVM Value Representation.
Definition Value.h:75
An efficient, type-erasing, non-owning reference to a callable.
initializer< Ty > init(const Ty &Val)
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > dyn_extract(Y &&MD)
Extract a Value from Metadata, if any.
Definition Metadata.h:707
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract(Y &&MD)
Extract a Value from Metadata.
Definition Metadata.h:679
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
LLVM_ABI cl::opt< bool > ProfcheckDisableMetadataFixes
Definition LoopInfo.cpp:61
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1755
LLVM_ABI bool extractProfTotalWeight(const MDNode *ProfileData, uint64_t &TotalWeights)
Retrieve the total of all weights from MD_prof data.
LLVM_ABI unsigned getBranchWeightOffset(const MDNode *ProfileData)
Return the offset to the first branch weight data.
LLVM_ABI void setExplicitlyUnknownBranchWeightsIfProfiled(Instruction &I, StringRef PassName, const Function *F=nullptr)
Like setExplicitlyUnknownBranchWeights(...), but only sets unknown branch weights in the new instruct...
LLVM_ABI bool isBranchWeightMD(const MDNode *ProfileData)
Checks if an MDNode contains Branch Weight Metadata.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
cl::opt< bool > EnableProfcheckInPipeline("enable-profcheck-in-pipeline", cl::init(false), cl::desc("Adds profile verification to the pipeline, erroring if profile " "information is dropped."))
LLVM_ABI bool isExplicitlyUnknownProfileMetadata(const MDNode &MD)
LLVM_ABI MDNode * getBranchWeightMDNode(const Instruction &I)
Get the branch weights metadata node.
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
Definition STLExtras.h:2224
LLVM_ABI void applyProfMetadataIfEnabled(Value *V, llvm::function_ref< void(Instruction *)> setMetadataCallback)
LLVM_ABI void setExplicitlyUnknownBranchWeights(Instruction &I, StringRef PassName)
Specify that the branch weights for this terminator cannot be known at compile time.
LLVM_ABI bool hasBranchWeightOrigin(const Instruction &I)
Check if Branch Weight Metadata has an "expected" field from an llvm.expect* intrinsic.
constexpr auto equal_to(T &&Arg)
Functor variant of std::equal_to that can be used as a UnaryPredicate in functional algorithms like a...
Definition STLExtras.h:2189
LLVM_ABI void setBranchWeights(Instruction &I, ArrayRef< uint32_t > Weights, bool IsExpected, bool ElideAllZero=false)
Create a new branch_weights metadata node and add or overwrite a prof metadata reference to instructi...
int countl_zero(T Val)
Count number of 0's from the most significant bit to the least stopping at the first 1.
Definition bit.h:263
LLVM_ABI SmallVector< uint32_t > fitWeights(ArrayRef< uint64_t > Weights)
Push the weights right to fit in uint32_t.
LLVM_ABI MDNode * getValidBranchWeightMDNode(const Instruction &I)
Get the valid branch weights metadata node.
LLVM_ABI bool hasValidBranchWeightMD(const Instruction &I)
Checks if an instructions has valid Branch Weight Metadata.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
LLVM_ABI MDNode * getExplicitlyUnknownBranchWeightsIfProfiled(Function &F, StringRef PassName)
Returns a metadata node containing unknown branch weights if the function has an entry count,...
LLVM_ABI void setExplicitlyUnknownFunctionEntryCount(Function &F, StringRef PassName)
Analogous to setExplicitlyUnknownBranchWeights, but for functions and their entry counts.
LLVM_ABI bool isValueProfileMD(const MDNode *ProfileData)
Checks if an MDNode contains value profiling Metadata.
LLVM_ABI unsigned getNumBranchWeights(const MDNode &ProfileData)
LLVM_ABI void extractFromBranchWeightMD32(const MDNode *ProfileData, SmallVectorImpl< uint32_t > &Weights)
Faster version of extractBranchWeights() that skips checks and must only be called with "branch_weigh...
LLVM_ABI bool hasExplicitlyUnknownBranchWeights(const Instruction &I)
LLVM_ABI bool hasProfMD(const Instruction &I)
Checks if an Instruction has MD_prof Metadata.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
Definition InstrProf.h:145
auto max_element(R &&Range)
Provide wrappers to std::max_element which take ranges instead of having to pass begin/end explicitly...
Definition STLExtras.h:2104
const IROptions & getIROptions(const LLVMContext &C)
Definition IROptions.h:27
LLVM_ABI bool extractBranchWeights(const MDNode *ProfileData, SmallVectorImpl< uint32_t > &Weights)
Extract branch weights from MD_prof metadata.
LLVM_ABI const char * LLVMLoopEstimatedTripCount
Profile-based loop metadata that should be accessed only by using llvm::getLoopEstimatedTripCount and...
uint32_t scaleBranchCount(uint64_t Count, uint64_t Scale)
Scale an individual branch count.
LLVM_ABI bool hasBranchWeightMD(const Instruction &I)
Checks if an instructions has Branch Weight Metadata.
LLVM_ABI void setFittedBranchWeights(Instruction &I, ArrayRef< uint64_t > Weights, bool IsExpected, bool ElideAllZero=false)
Variant of setBranchWeights where the Weights will be fit first to uint32_t by shifting right.
uint64_t calculateCountScale(uint64_t MaxCount)
Calculate what to divide by to scale counts.
LLVM_ABI SmallVector< uint32_t > downscaleWeights(ArrayRef< uint64_t > Weights, std::optional< uint64_t > KnownMaxCount=std::nullopt)
downscale the given weights preserving the ratio.
const uint64_t NOMORE_ICP_MAGICNUM
Magic number in the value profile metadata showing a target has been promoted for the instruction and...
Definition Metadata.h:59
LLVM_ABI void scaleProfData(Instruction &I, uint64_t S, uint64_t T)
Scaling the profile data attached to 'I' using the ratio of S/T.
LLVM_ABI void extractFromBranchWeightMD64(const MDNode *ProfileData, SmallVectorImpl< uint64_t > &Weights)
Faster version of extractBranchWeights() that skips checks and must only be called with "branch_weigh...
static LLVM_ABI const char * ExpectedBranchWeights
static LLVM_ABI const char * UnknownBranchWeightsMarker
static LLVM_ABI const char * ValueProfile
static LLVM_ABI const char * FunctionEntryCount
static LLVM_ABI const char * BranchWeights