24std::optional<PseudoProbe>
27 auto Discriminator = DIL->getDiscriminator();
46std::optional<PseudoProbe>
48 assert(isa<CallBase>(&Inst) && !isa<IntrinsicInst>(&Inst) &&
49 "Only call instructions should have pseudo probe encodes as their "
50 "Dwarf discriminators");
57 if (
const auto *
II = dyn_cast<PseudoProbeInst>(&Inst)) {
59 Probe.
Id =
II->getIndex()->getZExtValue();
61 Probe.
Attr =
II->getAttributes()->getZExtValue();
62 Probe.
Factor =
II->getFactor()->getZExtValue() /
70 if (isa<CallBase>(&Inst) && !isa<IntrinsicInst>(&Inst))
77 assert(Factor >= 0 && Factor <= 1 &&
78 "Distribution factor must be in [0, 1.0]");
79 if (
auto *
II = dyn_cast<PseudoProbeInst>(&Inst)) {
84 auto OrigFactor =
II->getFactor()->getZExtValue();
85 if (IntFactor != OrigFactor)
86 II->replaceUsesOfWith(
II->getFactor(), Builder.
getInt64(IntFactor));
87 }
else if (isa<CallBase>(&Inst) && !isa<IntrinsicInst>(&Inst)) {
90 auto Discriminator = DIL->getDiscriminator();
98 auto DwarfBaseDiscriminator =
107 Index,
Type, Attr, IntFactor, DwarfBaseDiscriminator);
uint64_t IntrinsicInst * II
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool isPseudoProbeDiscriminator(unsigned Discriminator)
const DILocation * cloneWithDiscriminator(unsigned Discriminator) const
Returns a new DILocation with updated Discriminator.
ConstantInt * getInt64(uint64_t C)
Get a constant 64-bit value.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
The instances of the Type class are immutable: once they are created, they are never changed.
This is an optimization pass for GlobalISel generic memory operations.
static constexpr uint64_t PseudoProbeFullDistributionFactor
std::optional< PseudoProbe > extractProbeFromDiscriminator(const DILocation *DIL)
void setProbeDistributionFactor(Instruction &Inst, float Factor)
std::optional< PseudoProbe > extractProbe(const Instruction &Inst)
static uint32_t extractProbeFactor(uint32_t Value)
static constexpr uint8_t FullDistributionFactor
static uint32_t extractProbeIndex(uint32_t Value)
static uint32_t packProbeData(uint32_t Index, uint32_t Type, uint32_t Flags, uint32_t Factor, std::optional< uint32_t > DwarfBaseDiscriminator)
static uint32_t extractProbeAttributes(uint32_t Value)
static std::optional< uint32_t > extractDwarfBaseDiscriminator(uint32_t Value)
static uint32_t extractProbeType(uint32_t Value)