llvm::InstrProfCallsite

This represents the llvm.instrprof.callsite intrinsic. It is structurally like the increment or step counters, hence the inheritance relationship, albeit somewhat tenuous (it's not 'counting' per se)

Synopsis

Declared in <llvm/IR/IntrinsicInst.h>

class InstrProfCallsite
    : public InstrProfCntrInstBase

Base Classes

NameDescription
InstrProfCntrInstBaseA base class for all instrprof counter intrinsics.

Types

NameDescription
BundleOpInfo Used to keep track of an operand bundle. See the main comment on OperandBundleUser above.
const_succ_iterator The const version of succ_iterator.
const_value_op_iterator
succ_iterator Iterator type that casts an operand to a basic block.
value_op_iterator Iterator for directly iterating over the operand Values.

Type Aliases

Name
InstListType
TailCallKindField
bundle_op_iterator
const_bundle_op_iterator
const_op_iterator
const_op_range
const_use_iterator
const_user_iterator
op_iterator
op_range
use_iterator
user_iterator

Enums

NameDescription
BinaryOps
CastOps
FuncletPadOps
MemoryOps
OperationEquivalenceFlags When checking for operation equivalence (using isSameOperationAs) it is sometimes useful to ignore certain attributes.
OtherOps
TailCallKind
TermOps
UnaryOps
ValueTy Concrete subclass of this.

Member Functions

NameDescription
operator= Assignment operators
DoPHITranslation Translate PHI node to its predecessor from the given basic block.
addAnnotationMetadata addAnnotationMetadata overloads
addAttributeAtIndex adds the attribute to the list of attributes.
addDereferenceableParamAttr adds the dereferenceable attribute to the list of attributes.
addDereferenceableRetAttr adds the dereferenceable attribute to the list of attributes.
addFnAttr Adds the attribute to the function.
addParamAttr Adds the attribute to the indicated argument
addParamAttrs Adds attributes to the indicated argument
addRangeRetAttr adds the range attribute to the list of attributes.
addRetAttr Adds the attribute to the return value.
addRetAttrs Adds attributes to the return value.
addUse This method should only be used by the Use class.
adoptDbgRecords Transfer any DbgRecords on the position It onto this instruction, by simply adopting the sequence of DbgRecords (which is efficient) if possible, by merging two sequences otherwise.
andIRFlags Logical 'and' of any supported wrapping, exact, and fast-math flags of V and this instruction.
applyMergedLocation Merge 2 debug locations and apply it to the Instruction. If the instruction is a CallIns, we need to traverse the inline chain to find the common scope. This is not efficient for N-way merging as each time you merge 2 iterations, you need to rebuild the hashmap to find the common scope. However, we still choose this API because: 1) Simplicity: it takes 2 locations instead of a list of locations. 2) In worst case, it increases the complexity from O(N*I) to O(2NI), where N is # of Instructions to merge, and I is the maximum level of inline stack. So it is still linear. 3) Merging of call instructions should be extremely rare in real applications, thus the N-way merging should be in code path. The DebugLoc attached to this instruction will be overwritten by the merged DebugLoc.
arg_begin Return the iterator pointing to the beginning of the argument list.
arg_empty
arg_end Return the iterator pointing to the end of the argument list.
arg_size
args Iteration adapter for range-for loops.
assertModuleIsMaterialized
assertModuleIsMaterializedImpl
bundleOperandHasAttr Return true if the bundle operand at index OpIdx has the attribute A.
bundle_op_info_begin Return the start of the list of BundleOpInfo instances associated with this OperandBundleUser.
bundle_op_info_end Return the end of the list of BundleOpInfo instances associated with this OperandBundleUser.
bundle_op_infos Return the range []bundle_op_info_begin, bundle_op_info_end).
canBeFreed Return true if the memory object referred to by V can by freed in the scope for which the SSA value defining the allocation is statically defined. E.g. deallocation after the static scope of a value does not count, but a deallocation before that does.
canReturnTwice Return true if the call can return twice
cannotDuplicate Determine if the invoke cannot be duplicated.
cannotMerge Determine if the call cannot be tail merged.
clone Create a copy of 'this' instruction that is identical in all ways except the following: * The instruction has no parent * The instruction has no name
cloneDebugInfoFrom Clone any debug-info attached to From onto this instruction. Used to copy debugging information from one block to another, when copying entire blocks.
comesBefore Given an instruction Other in the same basic block as this instruction, return true if this instruction comes before Other. In this worst case, this takes linear time in the number of instructions in the block. The results are cached, so in common cases when the block remains unmodified, it takes constant time.
copyFastMathFlags copyFastMathFlags overloads
copyIRFlags Convenience method to copy supported exact, fast-math, and (optionally) wrapping flags from V to this instruction.
copyMetadata Copy metadata from SrcInst to this instruction. WL, if not empty, specifies the list of meta data that needs to be copied. If WL is empty, all meta data will be copied.
copyProfileAndDebugMetadata Copy debug, profile, and memprof metadata from SrcInst to this instruction without copying alias-analysis or type-dependent metadata. TODO: Include additional metadata in the future if appropriate.
countOperandBundlesOfType countOperandBundlesOfType overloads
dataOperandHasImpliedAttr Return true if the data operand at index i has the attribute A.
data_operands_begin data_operands_begin/data_operands_end - Return iterators iterating over the call / invoke argument list and bundle operands. For invokes, this is the set of instruction operands except the invoke target and the two successor blocks; and for calls this is the set of instruction operands except the call target.
data_operands_empty
data_operands_end
data_operands_size
data_ops
deleteValue Delete a pointer to a generic Value.
doesNoCfCheck Determine if the call should not perform indirect branch tracking.
doesNotAccessMemory Determine if the call does not access memory.
doesNotCapture Determine whether this data operand is not captured.
doesNotReturn Determine if the call cannot return.
doesNotThrow Determine if the call cannot unwind.
dropAllReferences Drop all references to operands.
dropDbgRecords Erase any DbgRecords attached to this instruction.
dropDroppableUses Remove every uses that can safely be removed.
dropDroppableUsesIn Remove every use of this value in User that can safely be removed.
dropLocation Drop the instruction's debug location. This does not guarantee removal of the !dbg source location attachment, as it must set a line 0 location with scope information attached on call instructions. To guarantee removal of the !dbg attachment, use the setDebugLoc() API. Note: it is undefined behavior to call this on an instruction not currently inserted into a function.
dropOneDbgRecord Erase a single DbgRecord I that is attached to this instruction.
dropPoisonGeneratingAnnotations Drops flags, attributes and metadata that may generate poison.
dropPoisonGeneratingAttributes Drops attributes that may generate poison.
dropPoisonGeneratingFlags Drops flags that may cause this instruction to evaluate to poison despite having non-poison inputs.
dropPoisonGeneratingMetadata Drops metadata that may generate poison.
dropUBImplyingAttrsAndMetadata Drop any attributes or metadata that can cause immediate undefined behavior. Retain other attributes/metadata on a best-effort basis, as well as those passed in Keep. This should be used when speculating instructions.
dropUBImplyingAttrsAndUnknownMetadata This function drops non-debug unknown metadata (through dropUnknownNonDebugMetadata). For calls, it also drops parameter and return attributes that can cause undefined behaviour. Both of these should be done by passes which move instructions in IR.
dropUnknownNonDebugMetadata Drop all unknown metadata except for debug locations. @{ Passes are required to drop metadata they don't understand. This is a convenience method for passes to do so. dropUBImplyingAttrsAndUnknownMetadata should be used instead of this API if the Instruction being modified is a call.
dump Support for debugging, callable in GDB: V->dump()
eraseFromParent This method unlinks 'this' from the containing basic block and deletes it.
eraseMetadataIf Erase all metadata that matches the predicate.
extractProfTotalWeight Retrieve total raw weight values of a branch. Returns true on success with profile total weights filled in. Returns false if no metadata was found.
getAAMetadata Returns the AA metadata for this instruction.
getAccessType Return the type this instruction accesses in memory, if any.
getAllMetadata Get all metadata attached to this Instruction. The first element of each pair returned is the KindID, the second element is the metadata value. This list is returned sorted by the KindID.
getAllMetadataOtherThanDebugLoc This does the same thing as getAllMetadata, except that it filters out the debug location.
getArgOperand
getArgOperandNo getArgOperandNo overloads
getArgOperandUse Wrappers for getting the Use of a call argument.
getArgOperandWithAttribute If one of the arguments has the specified attribute, returns its operand value. Otherwise, return nullptr.
getAttributeAtIndex Get the attribute of a given kind at a position.
getAttributes Return the attributes for this call.
getBundleOpInfoForOperand Return the BundleOpInfo for the operand at index OpIdx.
getBundleOperandsEndIndex Return the index of the last bundle operand in the Use array.
getBundleOperandsStartIndex Return the index of the first bundle operand in the Use array.
getCalledFunction Returns the function called, or null if this is an indirect function invocation or the function signature does not match the call signature, or the call target is an alias.
getCalledOperand
getCalledOperandUse
getCallee
getCaller Helper to get the caller (the parent function).
getCallingConv
getCaptureInfo Return which pointer components this operand may capture.
getContext All values hold a context through their type.
getConvergenceControlToken Return the convergence control token for this call, if it exists.
getDataLayout Get the data layout of the module this instruction belongs to.
getDataOperandNo getDataOperandNo overloads
getDbgRecordRange Return a range over the DbgRecords attached to this instruction.
getDbgReinsertionPosition Return an iterator to the position of the "Next" DbgRecord after this instruction, or std::nullopt. This is the position to pass to BasicBlock::reinsertInstInDbgRecords when re-inserting an instruction.
getDebugLoc Return the debug location for this node as a DebugLoc.
getDescriptor Returns the descriptor co-allocated with this User instance.
getFastMathFlags Convenience function for getting all the fast-math flags, which must be an operator which supports these flags. See LangRef.html for the meaning of these flags.
getFastMathFlagsOrNone Convenience function for getting fast-math flags, or default-constructed FastMathFlags when not a FPMathOperator.
getFnAttr Get the attribute of a given kind for the function.
getFunction Return the function this instruction belongs to.
getFunctionType
getHash
getIndex
getInsertionPointAfterDef Get the first insertion point at which the result of this instruction is defined. This is not the directly following instruction in a number of cases, e.g. phi nodes or terminators that return values. This function may return null if the insertion after the definition is not possible, e.g. due to a catchswitch terminator.
getIntrinsicID Return the intrinsic ID of this intrinsic.
getMemoryEffects
getMetadata Get the metadata of given kind attached to this Instruction. If the metadata is not found then return null.
getModule Return the module owning the function this instruction belongs to or nullptr it the function does not have a module.
getName
getNameOrAsOperand
getNameValue
getNextNode Get the next node, or nullptr for the list tail.
getNumCounters
getNumOperandBundles Return the number of operand bundles associated with this User.
getNumOperands
getNumSuccessors Return the number of successors that this instruction has. The instruction must be a terminator.
getNumTotalBundleOperands Return the total number operands (not operand bundles) used by every operand bundle in this OperandBundleUser.
getNumUses This method computes the number of uses of this Value.
getOpcode Returns a member of one of the enums like Instruction::Add.
getOpcodeName
getOperand
getOperandBundle getOperandBundle overloads
getOperandBundleAt Return the operand bundle at a specific index.
getOperandBundleForOperand Return the operand bundle for the operand at index OpIdx.
getOperandBundlesAsDefs Return the list of operand bundles attached to this instruction as a vector of OperandBundleDefs.
getOperandList
getOperandUse
getParamAlign Extract the alignment for a call or parameter (0=unknown).
getParamAttr Get the attribute of a given kind from a given arg
getParamAttributes Return the param attributes for this call.
getParamByRefType Extract the byref type for a call or parameter.
getParamByValType Extract the byval type for a call or parameter.
getParamDereferenceableBytes Extract the number of dereferenceable bytes for a call or parameter (0=unknown).
getParamDereferenceableOrNullBytes Extract the number of dereferenceable_or_null bytes for a parameter (0=unknown).
getParamElementType Extract the elementtype type for a parameter. Note that elementtype() can only be applied to call arguments, not function declaration parameters.
getParamInAllocaType Extract the inalloca type for a call or parameter.
getParamNoFPClass Extract a test mask for disallowed floating-point value classes for the parameter.
getParamPreallocatedType Extract the preallocated type for a call or parameter.
getParamStackAlign
getParamStructRetType Extract the sret type for a call or parameter.
getPointerAlignment Returns an alignment of the pointer value.
getPointerDereferenceableBytes Returns the number of bytes known to be dereferenceable for the pointer value.
getPointerOffsetFrom If this ptr is provably equal to Other plus a constant offset, return that offset in bytes. Essentially ptr this subtract ptr Other.
getPrevNode getPrevNode overloads
getRange If this return value has a range attribute, return the value range of the argument. Otherwise, std::nullopt is returned.
getRawSubclassOptionalData Return the raw optional flags value contained in this value.
getRetAlign Extract the alignment of the return value.
getRetAttr Return the attribute for the given attribute kind for the return value.
getRetAttributes Return the return attributes for this call.
getRetDereferenceableBytes Extract the number of dereferenceable bytes for a call or parameter (0=unknown).
getRetDereferenceableOrNullBytes Extract the number of dereferenceable_or_null bytes for a call (0=unknown).
getRetNoFPClass Extract a test mask for disallowed floating-point value classes for the return value.
getReturnedArgOperand If one of the arguments has the 'returned' attribute, returns its operand value. Otherwise, return nullptr.
getSingleUndroppableUse Return true if there is exactly one use of this value that cannot be dropped.
getStableDebugLoc Fetch the debug location for this node, unless this is a debug intrinsic, in which case fetch the debug location of the next non-debug node.
getSuccessor Return the specified successor. This instruction must be a terminator.
getTailCallKind
getType All values are typed, get the type of this value.
getUniqueUndroppableUser Return true if there is exactly one unique user of this value that cannot be dropped (that user can have multiple uses of this value).
getValueID Return an ID for the concrete type of this object.
getValueName
handleMarkerRemoval Handle the debug-info implications of this instruction being removed. Any attached DbgRecords need to "fall" down onto the next instruction.
hasAllowContract Determine whether the allow-contract flag is set.
hasAllowReassoc Determine whether the allow-reassociation flag is set.
hasAllowReciprocal Determine whether the allow-reciprocal flag is set.
hasApproxFunc Determine whether the approximate-math-functions flag is set.
hasArgument Returns true if this CallSite passes the given Value* as an argument to the called function.
hasArgumentWithAdditionalReturnCaptureComponents Returns whether the call has an argument that has an attribute like captures(ret: address, provenance), where the return capture components are not a subset of the other capture components.
hasAtomicLoad Return true if this atomic instruction loads from memory.
hasAtomicStore Return true if this atomic instruction stores to memory.
hasByValArgument Determine if any call argument is an aggregate passed by value.
hasClobberingOperandBundles Return true if this operand bundle user has operand bundles that may write to the heap.
hasDbgRecords Returns true if any DbgRecords are attached to this instruction.
hasDeoptState Return true if the call has deopt state bundle.
hasFnAttr Determine whether this call has the given attribute. If it does not then determine if the called function has the attribute, but only if the attribute is allowed for the call.
hasIdenticalOperandBundleSchema Return true if Other has the same sequence of operand bundle tags with the same number of operands on each one of them as this OperandBundleUser.
hasInAllocaArgument Determine if there are is an inalloca argument. Only the last argument can have the inalloca attribute.
hasMetadata hasMetadata overloads
hasMetadataOtherThanDebugLoc Return true if this instruction has metadata attached to it other than a debug location.
hasNUndroppableUses Return true if there this value.
hasNUndroppableUsesOrMore Return true if this value has N uses or more.
hasNUses Return true if this Value has exactly N uses.
hasNUsesOrMore Return true if this value has N uses or more.
hasName
hasNoInfs Determine whether the no-infs flag is set.
hasNoNaNs Determine whether the no-NaNs flag is set.
hasNoSignedWrap Determine whether the no signed wrap flag is set.
hasNoSignedZeros Determine whether the no-signed-zeros flag is set.
hasNoUnsignedWrap Determine whether the no unsigned wrap flag is set.
hasNonDebugLocLoopMetadata
hasNonNeg Determine whether the the nneg flag is set.
hasOneUse Return true if there is exactly one use of this value.
hasOneUser Return true if there is exactly one user of this value.
hasOperandBundles Return true if this User has any operand bundles.
hasOperandBundlesOtherThan Return true if this operand bundle user contains operand bundles with tags other than those specified in IDs.
hasPoisonGeneratingAnnotations Return true if this instruction has poison-generating flags, attributes or metadata.
hasPoisonGeneratingAttributes Return true if this instruction has poison-generating attribute.
hasPoisonGeneratingFlags Return true if this operator has flags which may cause this instruction to evaluate to poison despite having non-poison inputs.
hasPoisonGeneratingMetadata Return true if this instruction has poison-generating metadata.
hasReadingOperandBundles Return true if this operand bundle user has operand bundles that may read from the heap.
hasRetAttr Determine whether the return value has the given attribute.
hasSameSpecialState This function determines if the speficied instruction has the same "special" characteristics as the current one. This means that opcode specific details are the same. As a common example, if we are comparing loads, then hasSameSpecialState would compare the alignments (among other things).
hasStructRetAttr Determine if the call returns a structure through first pointer argument.
hasUBImplyingAttrs Return true if this instruction has UB-implying attributes that can cause immediate undefined behavior.
hasUseList Check if this Value has a use-list.
hasValueHandle Return true if there is a value handle associated with this value.
insertAfter insertAfter overloads
insertBefore Insert an unlinked instruction into a basic block immediately before the specified position.
insertInto Inserts an unlinked instruction into ParentBB at position It and returns the iterator of the inserted instruction.
isArgOperand
isArithmeticShift Return true if this is an arithmetic shift right.
isAssociative
isAssumeLikeIntrinsic Checks if the intrinsic is an annotation.
isAtomic Return true if this instruction has an AtomicOrdering of unordered or higher.
isBinaryOp
isBitwiseLogicOp Return true if this is and/or/xor.
isBundleOperand isBundleOperand overloads
isByValArgument Determine whether this argument is passed by value.
isCallee isCallee overloads
isCast
isCommutableOperand Return true if the operand is commutable.
isCommutative Return true if swapping the first two arguments to the intrinsic produces the same result.
isConvergent Determine if the invoke is convergent
isDataOperand
isDebugOrPseudoInst Return true if the instruction is a DbgInfoIntrinsic or PseudoProbeInst.
isDroppable A droppable user is a user for which uses can be dropped without affecting correctness and should be dropped rather than preventing a transformation from happening.
isEHPad Return true if the instruction is a variety of EH-block.
isExact Determine whether the exact flag is set.
isFPDivRem
isFast Determine whether all fast-math-flags are set.
isFenceLike Return true if this instruction behaves like a memory fence: it can load or store to memory location without being given a memory location.
isFuncletPad
isIdempotent Return true if the instruction is idempotent:
isIdenticalTo Return true if the specified instruction is exactly identical to the current one. This means that all operands match and any extra information (e.g. load is volatile) agree.
isIdenticalToWhenDefined This is like isIdenticalTo, except that it ignores the SubclassOptionalData flags, which may specify conditions under which the instruction's result is undefined.
isInAllocaArgument Determine whether this argument is passed in an alloca.
isIndirectCall Return true if the callsite is an indirect call.
isInlineAsm Check if this call is an inline asm statement.
isIntDivRem
isLaunderOrStripInvariantGroup Return true if the instruction is a llvm.launder.invariant.group or llvm.strip.invariant.group.
isLifetimeStartOrEnd Return true if the instruction is a llvm.lifetime.start or llvm.lifetime.end marker.
isLogicalShift Return true if this is a logical shift left or a logical shift right.
isMustTailCall
isNilpotent Return true if the instruction is nilpotent:
isNoBuiltin Return true if the call should not be treated as a call to a builtin.
isNoInline Return true if the call should not be inlined.
isNoTailCall
isNonContinuableTrap Return true if the call is for a noreturn trap intrinsic.
isOnlyUserOfAnyOperand It checks if this instruction is the only user of at least one of its operands.
isOperandBundleOfType Return true if the operand at index Idx is a bundle operand that has tag ID ID.
isPassPointeeByValueArgument Determine whether this argument is passed by value, in an alloca, or is preallocated.
isPassingUndefUB Determine whether passing undef to this argument is undefined behavior. If passing undef to this argument is UB, passing poison is UB as well because poison is more undefined than undef.
isReturnNonNull Return true if the return value is known to be not null. This may be because it has the nonnull attribute, or because at least one byte is dereferenceable and the pointer is in addrspace(0).
isSafeToRemove Return true if the instruction can be removed if the result is unused.
isSameOperationAs This function determines if the specified instruction executes the same operation as the current one. This means that the opcodes, type, operand types and any other factors affecting the operation must be the same. This is similar to isIdenticalTo except the operands themselves don't have to be identical.
isShift
isSpecialTerminator
isStrictFP Determine if the call requires strict floating point semantics.
isSwiftError Return true if this value is a swifterror value.
isTailCall
isTerminator
isUnaryOp
isUsedByMetadata Return true if there is metadata referencing this value.
isUsedInBasicBlock Check if this value is used in the specified basic block.
isUsedOutsideOfBlock Return true if there are any uses of this instruction in blocks other than the specified block. Note that PHI nodes are considered to evaluate their operands in the corresponding predecessor block.
isVolatile Return true if this instruction has a volatile memory access.
materialized_use_begin
materialized_use_empty
materialized_user_begin
materialized_users
materialized_uses
mayHaveSideEffects Return true if the instruction may have side effects.
mayReadFromMemory Return true if this instruction may read memory.
mayReadOrWriteMemory Return true if this instruction may read or write memory.
maySynchronize Return true if this instruction may synchronize, in the sense that it may introduce a synchronizes-with edge.
mayThrow Return true if this instruction may throw an exception.
mayWriteToMemory Return true if this instruction may modify memory.
mergeDIAssignID Merge the DIAssignID metadata from this instruction and those attached to instructions in SourceInstructions. This process performs a RAUW on the MetadataAsValue uses of the merged DIAssignID nodes. Not every instruction in SourceInstructions needs to have DIAssignID metadata. If none of them do then nothing happens. If this instruction does not have a DIAssignID attachment but at least one in SourceInstructions does then the merged one will be attached to it. However, instructions without attachments in SourceInstructions are not modified.
moveAfter Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right after MovePos.
moveAfterPreserving See moveBeforePreserving .
moveBefore moveBefore overloads
moveBeforePreserving Perform a moveBefore operation, while signalling that the caller intends to preserve the original ordering of instructions. This implicitly means that any adjacent debug-info should move with this instruction.
mutateFunctionType
mutateType Mutate the type of this Value to be of the specified type.
onlyAccessesArgMemory Determine if the call can access memmory only using pointers based on its arguments.
onlyAccessesInaccessibleMemOrArgMem Determine if the function may only access memory that is either inaccessible from the IR or pointed to by its arguments.
onlyAccessesInaccessibleMemory Determine if the function may only access memory that is inaccessible from the IR.
onlyReadsMemory Determine if the call does not access or only reads memory.
onlyWritesMemory Determine if the call does not access or only writes memory.
op_begin
op_end
operandBundleFromBundleOpInfo Simple helper function to map a BundleOpInfo to an OperandBundleUse.
operand_bundles
operand_values
operands
operator delete Delete operators
paramHasAttr Determine whether the argument or parameter has the given attribute.
paramHasNonNullAttr Return true if this argument has the nonnull attribute on either the CallBase instruction or the called function. Also returns true if at least one byte is known to be dereferenceable and the pointer is in addrspace(0). If AllowUndefOrPoison is true, respect the semantics of nonnull attribute and return true even if the argument can be undef or poison.
populateBundleOperandInfos Populate the BundleOpInfo instances and the Use& vector from Bundles. Return the op_iterator pointing to the Use& one past the last last bundle operand use.
print Implement operator<< on Value. @{
printAsOperand Print the name of this Value out to the specified raw_ostream.
removeAttributeAtIndex removes the attribute from the list of attributes.
removeFnAttr Removes the attribute from the function
removeFnAttrs Removes the attributes from the function
removeFromParent This method unlinks 'this' from the containing basic block, but does not delete it.
removeParamAttr Removes the attribute from the given argument
removeParamAttrs Removes the attributes from the given argument
removeRetAttr Removes the attribute from the return value
removeRetAttrs Removes the attributes from the return value
replaceAllUsesWith Change all uses of this to point to a new Value.
replaceNonMetadataUsesWith Change non-metadata uses of this to point to a new Value.
replaceSuccessorWith Replace specified successor OldBB to point at the provided block. This instruction must be a terminator.
replaceUsesOfWith Replace uses of one Value with another.
replaceUsesOutsideBlock replaceUsesOutsideBlock - Go through the uses list for this definition and make each use point to "V" instead of "this" when the use is outside the block. 'This's use list is expected to have at least one element. Unlike replaceAllUsesWith() this function does not support basic block values.
replaceUsesWithIf Go through the uses list for this definition and make each use point to "V" if the callback ShouldReplace returns true for the given Use. Unlike replaceAllUsesWith() this function does not support basic block values. Returns whether any uses have been replaced.
returnDoesNotAlias Determine if the return value is marked with NoAlias attribute.
reverseUseList Reverse the use-list.
setAAMetadata Sets the AA metadata on this instruction from the AAMDNodes structure.
setArgOperand
setAttributes Set the attributes for this call.
setCalledFunction setCalledFunction overloads
setCalledOperand
setCallee
setCallingConv
setCanReturnTwice
setCannotDuplicate
setCannotMerge
setConvergent
setDebugLoc Set the debug location information for this instruction.
setDoesNotAccessMemory
setDoesNotReturn
setDoesNotThrow
setFast Set or clear all fast-math-flags on this instruction, which must be an operator which supports this flag. See LangRef.html for the meaning of this flag.
setFastMathFlags Convenience function for setting multiple fast-math flags on this instruction, which must be an operator which supports these flags. See LangRef.html for the meaning of these flags.
setHasAllowContract Set or clear the allow-contract flag on this instruction, which must be an operator which supports this flag. See LangRef.html for the meaning of this flag.
setHasAllowReassoc Set or clear the reassociation flag on this instruction, which must be an operator which supports this flag. See LangRef.html for the meaning of this flag.
setHasAllowReciprocal Set or clear the allow-reciprocal flag on this instruction, which must be an operator which supports this flag. See LangRef.html for the meaning of this flag.
setHasApproxFunc Set or clear the approximate-math-functions flag on this instruction, which must be an operator which supports this flag. See LangRef.html for the meaning of this flag.
setHasNoInfs Set or clear the no-infs flag on this instruction, which must be an operator which supports this flag. See LangRef.html for the meaning of this flag.
setHasNoNaNs Set or clear the no-nans flag on this instruction, which must be an operator which supports this flag. See LangRef.html for the meaning of this flag.
setHasNoSignedWrap Set or clear the nsw flag on this instruction, which must be an operator which supports this flag. See LangRef.html for the meaning of this flag.
setHasNoSignedZeros Set or clear the no-signed-zeros flag on this instruction, which must be an operator which supports this flag. See LangRef.html for the meaning of this flag.
setHasNoUnsignedWrap Set or clear the nuw flag on this instruction, which must be an operator which supports this flag. See LangRef.html for the meaning of this flag.
setIndex
setIsExact Set or clear the exact flag on this instruction, which must be an operator which supports this flag. See LangRef.html for the meaning of this flag.
setIsNoInline
setMemoryEffects
setMetadata Set the metadata of the specified kind to the specified node. This updates or replaces metadata if already present, or removes it if Node is null.
setName Change the name of the value.
setNameValue
setNoSanitizeMetadata Sets the nosanitize metadata on this instruction.
setNonNeg Set or clear the nneg flag on this instruction, which must be a zext instruction.
setNotConvergent
setNumHungOffUseOperands Subclasses with hung off uses need to manage the operand count themselves. In these instances, the operand count isn't used to find the OperandList, so there's no issue in having the operand count change.
setOnlyAccessesArgMemory
setOnlyAccessesInaccessibleMemOrArgMem
setOnlyAccessesInaccessibleMemory
setOnlyReadsMemory
setOnlyWritesMemory
setOperand
setSuccessor Update the specified successor to point at the provided block. This instruction must be a terminator.
setTailCall
setTailCallKind
setValueName
sortUseList Sort the use-list.
stripAndAccumulateConstantOffsets Accumulate the constant offset this value has compared to a base pointer. Only 'getelementptr' instructions (GEPs) are accumulated but other instructions, e.g., casts, are stripped away as well. The accumulated constant offset is added to Offset and the base pointer is returned.
stripAndAccumulateInBoundsConstantOffsets This is a wrapper around stripAndAccumulateConstantOffsets with the in-bounds requirement set to false.
stripInBoundsConstantOffsets Strip off pointer casts and all-constant inbounds GEPs.
stripInBoundsOffsets Strip off pointer casts and inbounds GEPs.
stripPointerCasts Strip off pointer casts, all-zero GEPs and address space casts.
stripPointerCastsAndAliases Strip off pointer casts, all-zero GEPs, address space casts, and aliases.
stripPointerCastsForAliasAnalysis Strip off pointer casts, all-zero GEPs, single-argument phi nodes and invariant group info.
stripPointerCastsSameRepresentation Strip off pointer casts, all-zero GEPs and address space casts but ensures the representation of the result stays the same.
successors
swapProfMetadata If the instruction has "branch_weights" MD_prof metadata and the MDNode has three operands (including name string), swap the order of the metadata.
takeName Transfer the name from V to this value.
tryIntersectAttributes Try to intersect the attributes from 'this' CallBase and the 'Other' CallBase. Sets the intersected attributes to 'this' and return true if successful. Doesn't modify 'this' and returns false if unsuccessful.
updateLocationAfterHoist Updates the debug location given that the instruction has been hoisted from a block to a predecessor of that block. Note: it is undefined behavior to call this on an instruction not currently inserted into a function.
updateProfWeight Updates profile metadata by scaling it by S / T.
use_begin
use_empty
use_end
user_back Specialize the methods defined in Value, as we know that an instruction can only be used by other instructions.
user_begin
user_empty
user_end
users
uses
value_op_begin
value_op_end
willReturn Return true if the instruction will return (unwinding is considered as a form of returning control flow here).

Static Member Functions

NameDescription
Create Create overloads
addOperandBundle Create a clone of CB with operand bundle OB added.
canInstrumentCallsite
classof Methods for support type inquiry through isa, cast, and dyn_cast:
dropDroppableUse Remove the droppable use U.
getOpcodeName
isAssociative
isBinaryOp
isBitwiseLogicOp Determine if the Opcode is and/or/xor.
isCast Determine if the Opcode is one of the CastInst instructions.
isCommutative
isFPDivRem
isFuncletPad Determine if the Opcode is one of the FuncletPadInst instructions.
isIdempotent
isIntDivRem
isNilpotent
isShift Determine if the Opcode is one of the shift instructions.
isSpecialTerminator Returns true if the Opcode is a "special" terminator that does more than branch to a successor (e.g. have a side effect or return a value).
isTerminator
isUnaryOp
mayLowerToFunctionCall Check if the intrinsic might lower into a regular function call in the course of IR transformations
removeOperandBundle Create a clone of CB with operand bundle ID removed.
removeOperandBundleAt

Data Members

NameDescription
DebugMarker Optional marker recording the position for debugging information that takes effect immediately before this instruction. Null unless there is debugging information present.

Static Data Members

NameDescription
MaxAlignmentExponent The maximum alignment for instructions.
MaximumAlignment

Using Declarations

Name
getContext

Protected Types

NameDescription
AllocInfo Information about how a User object was allocated, to be passed into the User constructor.
HungOffOperandsAllocMarker Indicates this User has operands "hung off" in another allocation.
IntrusiveOperandsAllocMarker Indicates this User has operands co-allocated.
IntrusiveOperandsAndDescriptorAllocMarker Indicates this User has operands and a descriptor co-allocated .

Protected Type Aliases

Name
AlignmentBitfieldElementT
AtomicOrderingBitfieldElementT
BoolBitfieldElementT
CallInstReservedField
CallingConvField
OpaqueField

Protected Enums

NameDescription
Unnamed enum The number of operands in the subclass.

Protected Member Functions

NameDescription
Op
addMetadata Add a metadata attachment. @{
allocHungoffUses Allocate the array of Uses, followed by a pointer (with bottom bit set) to the User.
clearMetadata Erase all metadata attached to this Value.
cloneImpl
eraseMetadata Erase all metadata attachments with the given kind.
eraseMetadataIf Erase all metadata attachments matching the given predicate.
getAllMetadata Appends all metadata attached to this value to MDs, sorting by KindID. The first element of each pair returned is the KindID, the second element is the metadata value. Attachments with the same ID appear in insertion order.
getMetadata Get the current metadata attachments for the given kind, if any.
getMetadataImpl Get metadata for the given kind, if any. This is an internal function that must only be called after checking that hasMetadata() returns true.
getNumSubclassExtraOperands
getNumSubclassExtraOperandsDynamic Get the number of extra operands for instructions that don't have a fixed number of extra operands.
getSubclassData
getSubclassDataFromValue
growHungoffUses Grow the number of hung off uses. Note that allocHungoffUses should be called if there are no uses.
hasDescriptor
operator new New operators
setMetadata Set a particular kind of metadata attachment.
setSubclassData
setValueSubclassData

Protected Static Member Functions

NameDescription
CountBundleInputs Return the total number of values used in Bundles.
OpFrom
isCounterBase
isMCDCBitmapBase

Protected Data Members

NameDescription
Attrs parameter attributes for callable
FMF
FTy
HasDescriptor
HasHungOffUses
HasName
IsUsedByMD
NumUserOperands
SubclassOptionalData Hold arbitary subclass data.

Protected Static Data Members

NameDescription
CalledOperandOpEndIdx The last operand is the called operand.

Protected Using Declarations

Name
CallBase

Non-Member Functions

NameDescription
CanInlineCallSiteCheck if it is legal to perform inlining of the function called by CB into the caller at this particular use, and sets fields in IFI.
ComputeMaxSignificantBitsGet the upper bound on bit size for this Value Op as a signed integer. i.e. x == sext(trunc(x to MaxSignificantBits) to bitwidth(x)). Similar to the APInt::getSignificantBits function.
ComputeNumSignBitsReturn the number of times the sign bit of the register is replicated into the other bits. We know that at least 1 bit is always equal to the sign bit (itself), but other cases can give us information. For example, immediately after an "ashr X, 2", we know that the top 3 bits are all equal to each other, so we return 3. For vectors, return the number of sign bits for the vector element with the mininum number of known sign bits.
ConstantFoldCallConstantFoldCall - Attempt to constant fold a call to the specified function with the specified arguments, returning null if unsuccessful.
ConstantFoldInstOperandsConstantFoldInstOperands - Attempt to constant fold an instruction with the specified operands. If successful, the constant result is returned, if not, null is returned. Note that this function can fail when attempting to fold instructions like loads and stores, which have no constant expression form.
ConstantFoldInstructionConstantFoldInstruction - Try to constant fold the specified instruction. If successful, the constant result is returned, if not, null is returned. Note that this fails if not all of the operands are constant. Otherwise, this function can only fail when attempting to fold instructions like loads and stores, which have no constant expression form.
DemoteRegToStackThis function takes a virtual register computed by an Instruction and replaces it with a slot in the stack frame, allocated via alloca. This allows the CFG to be changed around without fear of invalidating the SSA information for the value. It returns the pointer to the alloca inserted to create a stack slot for X.
ExtractTypeInfoExtractTypeInfo - Returns the type info, possibly bitcast, encoded in V.
FindInsertedValueGiven an aggregate and an sequence of indices, see if the scalar value indexed is already around as a register, for example if it were inserted directly into the aggregate.
GetPointerBaseWithConstantOffsetAnalyze the specified pointer to see if it can be expressed as a base pointer plus a constant offset. Return the base and offset to the caller.
GetStringLengthIf we can compute the length of the string pointed to by the specified pointer, return 'len+1'. If we can't, return 0.
InlineFunctionSame as above, but it will update the contextual profile. If the contextual profile is invalid (i.e. not loaded because it is not present), it defaults to the behavior of the non-contextual profile updating variant above. This makes it easy to drop-in replace uses of the non-contextual overload.
InlineFunctionThis function inlines the called function into the basic block of the caller. This returns false if it is not possible to inline this call. The program is still in a well defined state if this occurs though.
InlineFunctionImplThis should generally not be used, use InlineFunction instead.
MapValueLook up or compute a value in the value map.
MaskedValueIsZeroReturn true if 'V & Mask' is known to be zero. We use this predicate to simplify operations downstream. Mask is known to be zero for bits that V cannot have.
PointerMayBeCapturedPointerMayBeCaptured - Visit the value and the values derived from it and find values which appear to be capturing the pointer value. This feeds results into and is controlled by the CaptureTracker object. MaxUsesToExplore specifies how many uses the analysis should explore for one value before giving up due too "too many uses". If MaxUsesToExplore is zero, a default value is assumed. This function only considers captures of the passed value via its def-use chain, without considering captures of values it may be based on, or implicit captures such as for external globals.
PointerMayBeCapturedReturn which components of the pointer may be captured. Only consider components that are part of Mask. Once StopFn on the accumulated components returns true, the traversal is aborted early. By default, this happens when any of the components in Mask are captured. This function only considers captures of the passed value via its def-use chain, without considering captures of values it may be based on, or implicit captures such as for external globals.
PointerMayBeCapturedPointerMayBeCaptured - Return true if this pointer value may be captured by the enclosing function (which is required to exist). This routine can be expensive, so consider caching the results. The boolean ReturnCaptures specifies whether returning the value (or part of it) from the function counts as capturing it or not. MaxUsesToExplore specifies how many uses the analysis should explore for one value before giving up due too "too many uses". If MaxUsesToExplore is zero, a default value is assumed. This function only considers captures of the passed value via its def-use chain, without considering captures of values it may be based on, or implicit captures such as for external globals.
PointerMayBeCapturedBeforePointerMayBeCapturedBefore - Return true if this pointer value may be captured by the enclosing function (which is required to exist). If a DominatorTree is provided, only captures which happen before the given instruction are considered. This routine can be expensive, so consider caching the results. The boolean ReturnCaptures specifies whether returning the value (or part of it) from the function counts as capturing it or not. Captures by the provided instruction are considered if the final parameter is true. MaxUsesToExplore specifies how many uses the analysis should explore for one value before giving up due too "too many uses". If MaxUsesToExplore is zero, a default value is assumed. This function only considers captures of the passed value via its def-use chain, without considering captures of values it may be based on, or implicit captures such as for external globals.
PointerMayBeCapturedBeforeReturn which components of the pointer may be captured on the path to I. Only consider components that are part of Mask. Once StopFn on the accumulated components returns true, the traversal is aborted early. By default, this happens when any of the components in Mask are captured. This function only considers captures of the passed value via its def-use chain, without considering captures of values it may be based on, or implicit captures such as for external globals.
RecursivelyDeleteTriviallyDeadInstructionsIf the specified value is a trivially dead instruction, delete it. If that makes any of its operands trivially dead, delete them too, recursively. Return true if any instructions were deleted.
RemapInstructionConvert the instruction operands from referencing the current values into those specified by VM.
RemapSourceAtomRemap source location atom. Called by RemapInstruction. This updates the instruction's atom group number if it has been mapped (e.g. with llvm::mapAtomInstance), which is necessary to distinguish source code atoms on duplicated code paths.
ReplaceInstWithInstReplace the instruction specified by From with the instruction specified by To. Copies DebugLoc from BI to I, if I doesn't already have a DebugLoc.
SplitBlockAndInsertForEachLaneUtility function for performing a given action on each lane of a vector with EVL effective length. EVL is assumed > 0. To simplify porting legacy code, this defaults to unrolling the implied loop for non-scalable element counts, but this is not considered to be part of the contract of this routine, and is expected to change in the future. The callback takes as arguments an IRBuilder whose insert point is correctly set for instantiating the given index, and a value which is (at runtime) the index to access. This index may be a constant.
SplitBlockAndInsertIfElseSimilar to SplitBlockAndInsertIfThen, but the inserted block is on the false path of the branch.
SplitBlockAndInsertIfThenSplit the containing block at the specified instruction - everything before SplitBefore stays in the old basic block, and the rest of the instructions in the BB are moved to a new block. The two blocks are connected by a conditional branch (with value of Cmp being the condition). Before: Head SplitBefore Tail After: Head if (Cond) ThenBlock SplitBefore Tail
SplitBlockAndInsertIfThenElseSplit the containing block at the specified instruction - everything before SplitBefore stays in the old basic block, and the rest of the instructions in the BB are moved to a new block. The two blocks are connected by a conditional branch (with value of Cmp being the condition). Before: Head SplitBefore Tail After: Head if (Cond) TrueBlock else/ FalseBlock SplitBefore Tail
SplitBlockAndInsertIfThenElseSplitBlockAndInsertIfThenElse is similar to SplitBlockAndInsertIfThen, but also creates the ElseBlock. Before: Head SplitBefore Tail After: Head if (Cond) ThenBlock else ElseBlock SplitBefore Tail
SplitBlockAndInsertSimpleForLoopInsert a for (int i = 0; i < End; i++) loop structure (with the exception that End is assumed > 0, and thus not checked on entry) at SplitBefore. Returns the first insert point in the loop body, and the PHINode for the induction variable (i.e. "i" above).
SplitCriticalEdgeIf this edge is a critical edge, insert a new node to split the critical edge. This will update the analyses passed in through the option struct. This returns the new block if the edge was split, null otherwise.
SplitKnownCriticalEdgeIf it is known that an edge is critical, SplitKnownCriticalEdge can be called directly, rather than calling SplitCriticalEdge first.
UpgradeIntrinsicCallThis is the complement to the above, replacing a specific call to an intrinsic function with a call to the specified new function.
adaptNoAliasScopesAdapt the metadata for the specified instruction according to the provided mapping. This is normally used after cloning an instruction, when some noalias scopes needed to be cloned.
addAssumptionsAppends the set of assumptions Assumptions to CB.
addRuntimeChecksAdd code that checks at runtime if the accessed arrays in PointerChecks overlap. Returns the final comparator value or NULL if no check is needed.
buildAssumeFromInstBuild a call to llvm.assume to preserve informations that can be derived from the given instruction. If no information derived from I, this call returns null. The returned instruction is not inserted anywhere.
callsGCLeafFunctionReturn true if this call calls a gc leaf function.
canConstantFoldCallTocanConstantFoldCallTo - Return true if its even possible to fold a call to the specified function.
canInstructionHaveMMRAs
canReplaceOperandWithVariableGiven an instruction, is it legal to set operand OpIdx to a non-constant value?
canReplacePointersIfEqualReturns true if a pointer value From can be replaced with another pointer value To if they are deemed equal through some means (e.g. information from conditions). NOTE: The current implementation allows replacement in Icmp and PtrToInt instructions, as well as when we are replacing with a null pointer. Additionally it also allows replacement of pointers when both pointers have the same underlying object.
canSinkOrHoistInstReturns true if is legal to hoist or sink this instruction disregarding the possible introduction of faults. Reasoning about potential faulting instructions is the responsibility of the caller since it is challenging to do efficiently from within this routine. TargetExecutesOncePerLoop is true only when it is guaranteed that the target executes at most once per execution of the loop body. This is used to assess the legality of duplicating atomic loads. Generally, this is true when moving out of loop and not true when moving into loops. If ORE is set use it to emit optimization remarks.
cannotBeNegativeZeroReturn true if we can prove that the specified FP value is never equal to -0.0. Users should use caution when considering PreserveSign denormal-fp-math.
cannotBeOrderedLessThanZeroReturn true if we can prove that the specified FP value is either NaN or never less than -0.0.
changeToInvokeAndSplitBasicBlockConvert the CallInst to InvokeInst with the specified unwind edge basic block. This also splits the basic block where CI is located, because InvokeInst is a terminator instruction. Returns the newly split basic block.
changeToUnreachableInsert an unreachable instruction before the specified instruction, making it and the rest of the code in the block dead.
classifyEHPersonalitySee if the given exception handling personality function is one that we understand. If so, return a description of it; otherwise return Unknown.
collectPossibleValuesEnumerates all possible immediate values of V and inserts them into the set Constants. If AllowUndefOrPoison is false, it fails when V may contain undef/poison elements. Returns true if the result is complete. Otherwise, the result is incomplete (more than MaxCount values). NOTE: The constant values are not distinct.
combineAAMetadataCombine metadata of two instructions, where instruction J is a memory access that has been merged into K. This will intersect alias-analysis metadata, while preserving other known metadata.
combineMetadataForCSECombine the metadata of two instructions so that K can replace J. This specifically handles the case of CSE-like transformations. Some metadata can only be kept if K dominates J. For this to be correct, K cannot be hoisted.
computeConstantRangeDetermine the possible constant range of an integer or vector of integer value. This is intended as a cheap, non-recursive check.
computeKnownBitsReturns the known bits rather than passing by reference.
computeKnownBitsDetermine which bits of V are known to be either zero or one and return them in the KnownZero/KnownOne bit sets.
computeKnownBitsReturns the known bits rather than passing by reference.
computeKnownBitsFromContextMerge bits known from context-dependent facts into Known.
computeKnownFPClassWrapper to account for known fast math flags at the use instruction.
computeKnownFPClassInterestedClasses is a compile time optimization hint for which floating point classes should be queried. Queries not specified in InterestedClasses should be reliable if they are determined during the query.
computeKnownFPSignBitReturn false if we can prove that the specified FP value's sign bit is 0. Return true if we can prove that the specified FP value's sign bit is 1. Otherwise return std::nullopt.
createMemCpyLoopKnownSizeEmit a loop implementing the semantics of an llvm.memcpy whose size is a compile time constant. Loop is inserted at InsertBefore.
createMemCpyLoopUnknownSizeEmit a loop implementing the semantics of llvm.memcpy where the size is not a compile-time constant. Loop will be inserted at InsertBefore.
decomposeBitTestDecompose an icmp into the form ((X & Mask) pred C) if possible. Unless AllowNonZeroC is true, C will always be 0. If DecomposeAnd is specified, then, for equality predicates, this will decompose bitmasking via and.
decomposeBitTestICmpDecompose an icmp into the form ((X & Mask) pred C) if possible. Unless AllowNonZeroC is true, C will always be 0. If DecomposeAnd is specified, then, for equality predicates, this will decompose bitmasking via and.
dropDebugUsersRemove the debug intrinsic instructions for the given instruction.
emitBCmpEmit a call to the bcmp function.
emitBinaryFloatFnCallEmit a call to the binary function named 'Name' (e.g. 'fmin'). This function is known to take type matching 'Op1' and 'Op2' and return one value with the same type. If 'Op1/Op2' are long double, 'l' is added as the suffix of name, if 'Op1/Op2' are float, we add a 'f' suffix.
emitBinaryFloatFnCallEmit a call to the binary function DoubleFn, FloatFn or LongDoubleFn, depending of the type of Op1.
emitCallocEmit a call to the calloc function.
emitFPutCEmit a call to the fputc function. This assumes that Char is an 'int', and File is a pointer to FILE.
emitFPutSEmit a call to the fputs function. Str is required to be a pointer and File is a pointer to FILE.
emitFWriteEmit a call to the fwrite function. This assumes that Ptr is a pointer, Size is an 'size_t', and File is a pointer to FILE.
emitHotColdNewEmit a call to the hot/cold operator new function.
emitMallocEmit a call to the malloc function.
emitMemCCpyEmit a call to the memccpy function.
emitMemChrEmit a call to the memchr function. This assumes that Ptr is a pointer, Val is an 'int' value, and Len is an 'size_t' value.
emitMemCmpEmit a call to the memcmp function.
emitMemCpyChkEmit a call to the __memcpy_chk function to the builder. This expects that the Len and ObjSize have type 'size_t' and Dst/Src are pointers.
emitMemPCpyEmit a call to the mempcpy function.
emitMemRChrEmit a call to the memrchr function, analogously to emitMemChr.
emitPutCharEmit a call to the putchar function. This assumes that Char is an 'int'.
emitPutSEmit a call to the puts function. This assumes that Str is some pointer.
emitSNPrintfEmit a call to the snprintf function.
emitSPrintfEmit a call to the sprintf function.
emitStpCpyEmit a call to the stpcpy function to the builder, for the specified pointer arguments.
emitStpNCpyEmit a call to the stpncpy function to the builder, for the specified pointer arguments and length.
emitStrCatEmit a call to the strcat function.
emitStrChrEmit a call to the strchr function to the builder, for the specified pointer and character. Ptr is required to be some pointer type, and the return value has 'i8*' type.
emitStrCpyEmit a call to the strcpy function to the builder, for the specified pointer arguments.
emitStrDupEmit a call to the strdup function to the builder, for the specified pointer. Ptr is required to be some pointer type, and the return value has 'i8*' type.
emitStrLCatEmit a call to the strlcat function.
emitStrLCpyEmit a call to the strlcpy function.
emitStrLenEmit a call to the strlen function to the builder, for the specified pointer. Ptr is required to be some pointer type, and the return value has 'size_t' type.
emitStrNCatEmit a call to the strncat function.
emitStrNCmpEmit a call to the strncmp function to the builder.
emitStrNCpyEmit a call to the strncpy function to the builder, for the specified pointer arguments and length.
emitUnaryFloatFnCallEmit a call to the unary function DoubleFn, FloatFn or LongDoubleFn, depending of the type of Op.
emitUnaryFloatFnCallEmit a call to the unary function named 'Name' (e.g. 'floor'). This function is known to take a single of type matching 'Op' and returns one value with the same type. If 'Op' is a long double, 'l' is added as the suffix of name, if 'Op' is a float, we add a 'f' suffix.
emitVSNPrintfEmit a call to the vsnprintf function.
emitVSPrintfEmit a call to the vsprintf function.
emitWcsLenEmit a call to the wcslen function to the builder, for the specified pointer. Ptr is required to be some pointer type, and the return value has 'size_t' type.
extractBranchWeightsExtract branch weights attatched to an Instruction
extractBranchWeightsExtract branch weights from a conditional branch or select Instruction.
extractProfTotalWeightRetrieve the total of all weights from an instruction.
findAllocaForValueReturns unique alloca where the value comes from, or nullptr. If OffsetZero is true check that V points to the begining of the alloca.
findDVRDeclareValuesAs above, for DVRDeclareValues.
findDVRDeclaresFinds dbg.declare records declaring local variables as living in the memory that 'V' points to.
findDVRValuesAs above, for DVRValues.
findDbgUsersFinds the debug info records describing a value.
findDbgValuesFinds the dbg.values describing a value.
findScalarElementGiven a vector and an element number, see if the scalar value is already around as a register, for example if it were inserted then extracted from the vector.
findValuesAffectedByConditionCall InsertAffected on all Values whose known bits / value may be affected by the condition Cond. Used by AssumptionCache and DomConditionCache.
forEachCallbackCallSiteApply function Func to each CB's callback call site.
forEachCallbackFunctionApply function Func to each CB's callback function.
funcReturnsFirstArgOfCallReturns true if the parent of CI returns CI's first argument after calling CI.
getAllocAlignmentGets the alignment argument for an aligned_alloc-like function, using either built-in knowledge based on fuction names/signatures or allocalign attributes. Note: the Value returned may not indicate a valid alignment, per the definition of the allocalign attribute.
getAllocSizeReturn the size of the requested allocation. With a trivial mapper, this is similar to calling getObjectSize(..., Exact), but without looking through calls that return their argument. A mapper function can be used to replace one Value* (operand to the allocation) with another. This is useful when doing abstract interpretation.
getAllocationFamilyIf a function is part of an allocation family (e.g. malloc/realloc/calloc/free), return the identifier for its family of functions.
getArgumentAliasingToReturnedPointerThis function returns call pointer argument that is considered the same by aliasing rules. You CAN'T use it to replace one value with another. If MustPreserveOffset is true, the call must preserve the byte offset of the pointer within its underlying object. Offset preservation implies nullness preservation; pass true when callers reason about either offset or null equality (e.g. GEP decomposition, dereferenceability, isKnownNonZero).
getAssumptionsReturn the set of all assumptions for the call CB.
getAtomicSyncScopeIDA helper function that returns an atomic operation's sync scope; returns std::nullopt if it is not an atomic operation.
getAttributeBasedInliningDecisionReturns InlineResult::success() if the call site should be always inlined because of user directives, and the inlining is viable. Returns InlineResult::failure() if the inlining may never happen because of user directives or incompatibilities detectable without needing callee traversal. Otherwise returns std::nullopt, meaning that inlining should be decided based on other criteria (e.g. cost modeling).
getBaseObjectSizeLike getObjectSize(), but only returns the size of base objects (like allocas, global variables and allocator calls) and std::nullopt otherwise. Requires ExactSizeFromOffset mode.
getBranchWeightMDNodeGet the branch weights metadata node
getConstantDataArrayInfoReturns true if the value V is a pointer into a ConstantDataArray. If successful Slice will point to a ConstantDataArray info object with an appropriate offset.
getConstantStringInfoThis function computes the length of a null-terminated C string pointed to by V. If successful, it returns true and returns the string in Str. If unsuccessful, it returns false. This does not include the trailing null character by default. If TrimAtNul is set to false, then this returns any trailing null characters as well as any other characters that come after it.
getConstrainedIntrinsicIDReturns constrained intrinsic id to represent the given instruction in strictfp function. If the instruction is already a constrained intrinsic or does not have a constrained intrinsic counterpart, the function returns zero.
getDeinterleavedVectorTypeGiven a deinterleaveN intrinsic, return the (narrow) vector type of each factor.
getFreedOperandIf this if a call to a free function, return the freed operand.
getInitialValueOfAllocationIf this is a call to an allocation function that initializes memory to a fixed value, return said value in the requested type. Otherwise, return nullptr.
getInlineCostGet an InlineCost object representing the cost of inlining this callsite.
getInlineCostGet an InlineCost with the callee explicitly specified. This allows you to calculate the cost of inlining a function via a pointer. This behaves exactly as the version with no explicit callee parameter in all other respects.
getInliningCostEstimateGet the cost estimate ignoring thresholds. This is similar to getInlineCost when passed InlineParams::ComputeFullInlineCost, or a non-null ORE. It uses default InlineParams otherwise. Contrary to getInlineCost, which makes a threshold-based final evaluation of should/shouldn't inline, captured in InlineResult, getInliningCostEstimate returns: - std::nullopt, if the inlining cannot happen (is illegal) - an integer, representing the cost.
getInliningCostFeaturesGet the expanded cost features. The features are returned unconditionally, even if inlining is impossible.
getIntrinsicForCallSiteMap a call instruction to an intrinsic ID. Libcalls which have equivalent intrinsics are treated as-if they were intrinsics.
getKnowledgeForValueReturn a valid Knowledge associated to the Value V if its Attribute kind is in AttrKinds and it matches the Filter.
getKnowledgeValidInContextReturn a valid Knowledge associated to the Value V if its Attribute kind is in AttrKinds and the knowledge is suitable to be used in the context of CtxI.
getKnownAlignmentTry to infer an alignment for the specified pointer.
getLoadStoreAddressSpaceA helper function that returns the address space of the pointer operand of load or store instruction.
getLoadStoreAlignmentA helper function that returns the alignment of load or store instruction.
getLoadStorePointerOperandA helper function that returns the pointer operand of a load or store instruction. Returns nullptr if not load or store.
getLoadStoreTypeA helper function that returns the type of a load or store instruction.
getMemCacheHintMetadataReturn the cache hint metadata node for memory operand OperandNo on I, or nullptr when the instruction has no hint for that operand. For a CallBase, OperandNo is an argument index; otherwise it is an instruction operand index.
getMetadataToPropagateAdd metadata from Inst to Metadata, if it can be preserved after vectorization. It can be preserved after vectorization if the kind is one of [MD_tbaa, MD_alias_scope, MD_noalias, MD_fpmath, MD_nontemporal,] MD_access_group, MD_mmra].
getObjectSizeCompute the size of the object pointed by Ptr. Returns true and the object size in Size if successful, and false otherwise. In this context, by object we mean the region of memory starting at Ptr to the end of the underlying object pointed to by Ptr.
getOrEnforceKnownAlignmentTry to ensure that the alignment of V is at least PrefAlign bytes. If the owning object can be modified and has an alignment less than PrefAlign, it will be increased and PrefAlign returned. If the alignment cannot be increased, the known alignment of the value is returned.
getPointerOperandA helper function that returns the pointer operand of a load, store or GEP instruction. Returns nullptr if not load, store, or GEP.
getReallocatedOperandIf this is a call to a realloc function, return the reallocated operand.
getSplatValueGet splat value if the input is a splat vector or return nullptr. The value may be extracted from a splat constants vector or from a sequence of instructions that broadcast a single value into a vector.
getUnderlyingObjectThis method strips off any GEP address adjustments, pointer casts or llvm.threadlocal.address from the specified value V, returning the original object being addressed. Note that the returned value has pointer type if the specified value does. If the MaxLookup value is non-zero, it limits the number of instructions to be stripped off.
getUnderlyingObjectAggressiveLike getUnderlyingObject(), but will try harder to find a single underlying object. In particular, this function also looks through selects and phis.
getUnderlyingObjectsThis method is similar to getUnderlyingObject except that it can look through phi and select instructions and return multiple objects.
getUnderlyingObjectsForCodeGenThis is a wrapper around getUnderlyingObjects and adds support for basic ptrtoint+arithmetic+inttoptr sequences.
getValidBranchWeightMDNodeGet the valid branch weights metadata node
getValueProfDataFromInstExtract the value profile data from Inst and returns them if Inst is annotated with value profile data. Returns an empty vector otherwise.
getVectorIntrinsicIDForCallReturns intrinsic ID for call. For the input call instruction it finds mapping intrinsic and returns its intrinsic ID, in case it does not found it return not_intrinsic.
handleUnreachableTerminatorIf a terminator in an unreachable basic block has an operand of type Instruction, transform it into poison. Return true if any operands are changed to poison. Original Values prior to being changed to poison are returned in PoisonedValues.
hasAssumptionReturn true if CB or the callee has the assumption AssumptionStr attached.
hasBranchWeightMDChecks if an instructions has Branch Weight Metadata
hasBranchWeightOriginCheck if Branch Weight Metadata has an "expected" field from an llvm.expect* intrinsic
hasProfMDChecks if an Instruction has MD_prof Metadata
hasValidBranchWeightMDChecks if an instructions has valid Branch Weight Metadata
impliesPoisonReturn true if V is poison given that ValAssumedPoison is already poison. For example, if ValAssumedPoison is icmp X, 10 and V is icmp X, 5, impliesPoison returns true.
intersectAccessGroupsCompute the access-group list of access groups that Inst1 and Inst2 are both in. If either instruction does not access memory at all, it is considered to be in every list.
invertConditionInvert the given true/false value, possibly reusing an existing copy.
isAllocLikeFnTests if a value is a call or invoke to a library function that allocates memory (either malloc, calloc, or strdup like).
isAllocationFnTests if a value is a call or invoke to a library function that allocates or reallocates memory (either malloc, calloc, realloc, or strdup like).
isAssumeLikeIntrinsicReturn true if it is an intrinsic that cannot be speculated but also cannot trap.
isBaseOfObjectReturn true if we know V to the base address of the corresponding memory object. This implies that any address less than V must be out of bounds for the underlying object. Note that just being isIdentifiedObject() is not enough - For example, a negative offset from a noalias argument or call can be inbounds w.r.t the actual underlying object.
isBytewiseValueIf the specified value can be set by repeating the same byte in memory, return the i8 value that it is represented with. This is true for all i8 values obviously, but is also true for i32 0, i32 -1, i16 0xF0F0, double 0.0 etc. If the value can't be handled with a repeated byte store (e.g. i16 0x1234), return null. If the value is entirely undef and padding, return undef.
isCheckForZeroAndMulWithOverflowMatch one of the patterns up to the select/logic op: %Op0 = icmp ne i4 %X, 0 %Agg = call { i4, i1 } llvm.[us]mul.with.overflow.i4(i4 %X, i4 %Y) %Op1 = extractvalue { i4, i1 } %Agg, 1 %ret = select i1 %Op0, i1 %Op1, i1 false / %ret = and i1 %Op0, %Op1
isConsecutiveAccessReturns true if the memory operations A and B are consecutive. This is a simple API that does not depend on the analysis pass.
isCriticalEdgeReturn true if the specified edge is a critical edge. Critical edges are edges from a block with multiple successors to a block with multiple predecessors.
isDereferenceableAndAlignedPointerReturns true if V is always a dereferenceable pointer with alignment greater or equal than requested. If the context instruction is specified performs context-sensitive analysis and returns true if the pointer is dereferenceable at the specified instruction. If IgnoreFree is set, ignore potential frees of the object.
isDereferenceableAndAlignedPointerReturns true if V is always dereferenceable for Size byte with alignment greater or equal than requested. If the context instruction is specified performs context-sensitive analysis and returns true if the pointer is dereferenceable at the specified instruction. If IgnoreFree is set, ignore potential frees of the object.
isDereferenceablePointerEquivalent to isDereferenceableAndAlignedPointer with an alignment of 1.
isDereferenceablePointerEquivalent to isDereferenceableAndAlignedPointer with an alignment of 1.
isEscapeSourceReturns true if the pointer is one which would have been considered an escape by isNotCapturedBefore.
isGuaranteedNotToBePoisonReturns true if V cannot be poison, but may be undef.
isGuaranteedNotToBeUndefReturns true if V cannot be undef, but may be poison.
isGuaranteedNotToBeUndefOrPoisonReturn true if this function can prove that V does not have undef bits and is never poison. If V is an aggregate value or vector, check whether all elements (except padding) are not undef or poison. Note that this is different from canCreateUndefOrPoison because the function assumes Op's operands are not poison/undef.
isGuaranteedToExecuteForEveryIterationReturn true if this function can prove that the instruction I is executed for every iteration of the loop L.
isGuaranteedToTransferExecutionToSuccessorReturn true if this function can prove that the instruction I will always transfer execution to one of its successors (including the next instruction that follows within a basic block). E.g. this is not guaranteed for function calls that could loop infinitely.
isGuardReturns true iff U has semantics of a guard expressed in a form of call of llvm.experimental.guard intrinsic.
isGuardAsWidenableBranchReturns true iff U has semantics of a guard expressed in a form of a widenable conditional branch to deopt block.
isIdentifiedFunctionLocalReturn true if V is umabigously identified at the function-level. Different IdentifiedFunctionLocals can't alias. Further, an IdentifiedFunctionLocal can not alias with any function arguments other than itself, which is not necessarily true for IdentifiedObjects.
isIdentifiedObjectReturn true if this pointer refers to a distinct and identifiable object. This returns true for: Global Variables and Functions (but not Global Aliases) Allocas ByVal and NoAlias Arguments NoAlias returns (e.g. calls to malloc)
isImpliedByDomConditionReturn the boolean condition value in the context of the given instruction if it is known based on dominating conditions.
isImpliedConditionReturn true if RHS is known to be implied true by LHS. Return false if RHS is known to be implied false by LHS. Otherwise, return std::nullopt if no implication can be made. A & B must be i1 (boolean) values or a vector of such values. Note that the truth table for implication is the same as <=u on i1 values (but not <=s!). The truth table for both is: | T | F (B) T | T | F F | T | T (A)
isInTailCallPositionTest if the given instruction is in a position to be optimized with a tail-call. This roughly means that it's in a block with a return and there's nothing that needs to be scheduled between it and the return.
isInstructionTriviallyDeadReturn true if the result produced by the instruction is not used, and the instruction will return. Certain side-effecting instructions are also considered dead if there are no uses of the instruction.
isIntrinsicReturningPointerAliasingArgumentWithoutCapturing{launder,strip}.invariant.group returns pointer that aliases its argument, and it only captures pointer by returning it. These intrinsics are not marked as nocapture, because returning is considered as capture. The arguments are not marked as returned neither, because it would make it useless. If MustPreserveOffset is true, the intrinsic must preserve the byte offset of the pointer within its underlying object (which excludes llvm.ptrmask, since masking off low bits changes the byte offset while still aliasing the same object).
isKnownIntegralReturn true if the floating-point value V is known to be an integer value.
isKnownInversionReturn true iff: 1. X is poison implies Y is poison. 2. X is true implies Y is false. 3. X is false implies Y is true. Otherwise, return false.
isKnownNegationReturn true if the two given values are negation. Currently can recoginze Value pair: 1: <X, Y> if X = sub (0, Y) or Y = sub (0, X) 2: <X, Y> if X = sub (A, B) and Y = sub (B, A)
isKnownNegativeReturns true if the given value is known be negative (i.e. non-positive and non-zero).
isKnownNeverInfOrNaNReturn true if the floating-point value can never contain a NaN or infinity.
isKnownNeverInfinityReturn true if the floating-point scalar value is not an infinity or if the floating-point vector value has no infinities. Return false if a value could ever be infinity.
isKnownNeverNaNReturn true if the floating-point scalar value is not a NaN or if the floating-point vector value has no NaN elements. Return false if a value could ever be NaN.
isKnownNonEqualReturn true if the given values are known to be non-equal when defined. Supports scalar integer types only.
isKnownNonNegativeReturns true if the give value is known to be non-negative.
isKnownNonZeroReturn true if the given value is known to be non-zero when defined. For vectors, return true if every element is known to be non-zero when defined. For pointers, if the context instruction and dominator tree are specified, perform context-sensitive analysis and return true if the pointer couldn't possibly be null at the specified instruction. Supports values with integer or pointer type and vectors of integers.
isKnownPositiveReturns true if the given value is known be positive (i.e. non-negative and non-zero).
isKnownToBeAPowerOfTwoReturn true if the given value is known to have exactly one bit set when defined. For vectors return true if every element is known to be a power of two when defined. Supports values with integer or pointer type and vectors of integers. If 'OrZero' is set, then return true if the given value is either a power of two or zero.
isLegalToPromoteReturn true if the given indirect call site can be made to call Callee.
isMathLibCallNoopCheck whether the given call has no side-effects. Specifically checks for math routimes which sometimes set errno.
isNoAliasCallReturn true if this pointer is returned by a noalias function.
isNotCrossLaneOperationReturn true if the instruction doesn't potentially cross vector lanes. This condition is weaker than checking that the instruction is lanewise: lanewise means that the same operation is splatted across all lanes, but we also include the case where there is a different operation on each lane, as long as the operation only uses data from that lane. An example of an operation that is not lanewise, but doesn't cross vector lanes is insertelement.
isNotVisibleOnUnwindReturn true if Object memory is not visible after an unwind, in the sense that program semantics cannot depend on Object containing any particular value on unwind. If the RequiresNoCaptureBeforeUnwind out parameter is set to true, then the memory is only not visible if the object has not been captured prior to the unwind. Otherwise it is not visible even if captured.
isPotentiallyReachableDetermine whether instruction 'To' is reachable from 'From', without passing through any blocks in ExclusionSet, returning true if uncertain.
isRemovableAllocReturn true if this is a call to an allocation function that does not have side effects that we are required to preserve beyond the effect of allocating a new object. Ex: If our allocation routine has a counter for the number of objects allocated, and the program prints it on exit, can the value change due to optimization? Answer is highly language dependent. Note: Removable really does mean removable; it does not mean observable. A language (e.g. C++) can allow removing allocations without allowing insertion or speculative execution of allocation routines.
isSafeToLoadUnconditionallyReturn true if we know that executing a load from this value cannot trap.
isSafeToLoadUnconditionallyReturn true if we know that executing a load from this value cannot trap.
isSafeToMoveBeforeReturn true if I can be safely moved before InsertPoint.
isSafeToSpeculativelyExecuteReturn true if the instruction does not have any effects besides calculating the result and does not have undefined behavior.
isSafeToSpeculativelyExecuteWithVariableReplacedDon't use information from its non-constant operands. This helper is used when its operands are going to be replaced.
isSplatValueReturn true if each element of the vector value V is poisoned or equal to every other non-poisoned element. If an index element is specified, either every element of the vector is poisoned or the element at that index is not poisoned and equal to every other non-poisoned element. This may be more powerful than the related getSplatValue() because it is not limited by finding a scalar source value to a splatted vector.
isValidAssumeForContextReturn true if it is valid to use the assumptions provided by an assume intrinsic, I, at the point in the control-flow identified by the context instruction, CxtI. By default, ephemeral values of the assumption are treated as an invalid context, to prevent the assumption from being used to optimize away its argument. If the caller can ensure that this won't happen, it can call with AllowEphemerals set to true to get more valid assumptions.
isWidenableBranchReturns true iff U is a widenable branch (that is, extractWidenableCondition returns widenable condition).
isWidenableConditionReturns true iff V has semantics of llvm.experimental.widenable.condition call
isWritableObjectReturn true if the Object is writable, in the sense that any location based on this pointer that can be loaded can also be stored to without trapping. Additionally, at the point Object is declared, stores can be introduced without data races. At later points, this is only the case if the pointer can not escape to a different thread.
lowerObjectSizeCallTry to turn a call to @llvm.objectsize into an integer value of the given Type. Returns null on failure. If MustSucceed is true, this function will not return null, and may return conservative values governed by the second argument of the call to objectsize.
maskContainsAllOneOrUndefGiven a mask vector of i1, Return true if any of the elements of this predicate mask are known to be true or undef. That is, return true if at least one lane can be assumed active.
matchSelectPatternPattern match integer [SU]MIN, [SU]MAX and ABS idioms, returning the kind and providing the out parameter results if we successfully match.
matchSimpleBinaryIntrinsicRecurrenceAttempt to match a simple value-accumulating recurrence of the form: %llvm.intrinsic.acc = phi Ty [%Init, %Entry], [%llvm.intrinsic, %backedge] %llvm.intrinsic = call Ty llvm.intrinsic(%OtherOp, %llvm.intrinsic.acc) OR %llvm.intrinsic.acc = phi Ty [%Init, %Entry], [%llvm.intrinsic, %backedge] %llvm.intrinsic = call Ty llvm.intrinsic(%llvm.intrinsic.acc, %OtherOp)
matchSimpleTernaryIntrinsicRecurrenceAttempt to match a simple value-accumulating recurrence of the form: %llvm.intrinsic.acc = phi Ty [%Init, %Entry], [%llvm.intrinsic, %backedge] %llvm.intrinsic = call Ty llvm.intrinsic(%OtherOp0, %OtherOp1, %llvm.intrinsic.acc) OR %llvm.intrinsic.acc = phi Ty [%Init, %Entry], [%llvm.intrinsic, %backedge] %llvm.intrinsic = call Ty llvm.intrinsic(%llvm.intrinsic.acc, %OtherOp0, %OtherOp1)
mayHaveMemprofSummaryReturns true if the instruction could have memprof metadata, used to ensure consistency between summary analysis and the ThinLTO backend processing.
mayHaveNonDefUseDependencyReturns true if the result or effects of the given instructions I depend values not reachable through the def use graph. * Memory dependence arises for example if the instruction reads from memory or may produce effects or undefined behaviour. Memory dependent instructions generally cannot be reorderd with respect to other memory dependent instructions. * Control dependence arises for example if the instruction may fault if lifted above a throwing call or infinite loop.
maybeMarkSanitizerLibraryCallNoBuiltinGiven a CallInst, check if it calls a string function known to CodeGen, and mark it with NoBuiltin if so. To be used by sanitizers that intend to intercept string functions and want to avoid converting them to target specific instructions.
mustExecuteUBIfPoisonOnPathToReturn true if undefined behavior would provable be executed on the path to OnPathTo if Root produced a posion result. Note that this doesn't say anything about whether OnPathTo is actually executed or whether Root is actually poison. This can be used to assess whether a new use of Root can be added at a location which is control equivalent with OnPathTo (such as immediately before it) without introducing UB which didn't previously exist. Note that a false result conveys no information.
mustTriggerUBReturn true if the given instruction must trigger undefined behavior when I is executed with any operands which appear in KnownPoison holding a poison value at the point of execution.
onlyUsedByLifetimeMarkersReturn true if the only users of this pointer are lifetime markers.
onlyUsedByLifetimeMarkersOrDroppableInstsReturn true if the only users of this pointer are lifetime markers or droppable instructions.
parseWidenableBranchAnalogous to the above, but return the Uses so that they can be modified. Unlike previous version, Condition is optional and may be null.
parseWidenableBranchIf U is widenable branch looking like: %cond = ... %wc = call i1 llvm.experimental.widenable.condition() %branch_cond = and i1 %cond, %wc br i1 %branch_cond, label %if_true_bb, label %if_false_bb ; <--- U The function returns true, and the values %cond and %wc and blocks %if_true_bb, if_false_bb are returned in the parameters (Condition, WidenableCondition, IfTrueBB and IfFalseFF) respectively. If U does not match this pattern, return false.
patchReplacementInstructionPatch the replacement so that it is not more restrictive than the value being replaced. It assumes that the replacement does not get moved from its original position.
possiblyDemandedEltsInMaskGiven a mask vector of the form <Y x i1>, return an APInt (of bitwidth Y) for each lane which may be active.
programUndefinedIfUndefOrPoisonReturn true if this function can prove that if Inst is executed and yields a poison value or undef bits, then that will trigger undefined behavior.
promoteCallPromote the given indirect call site to unconditionally call Callee.
promoteCallWithIfThenElsePromote the given indirect call site to conditionally call Callee. The promoted direct call instruction is predicated on `CB.getCalledOperand() == Callee`.
promoteCallWithVTableCmpThis is similar to promoteCallWithIfThenElse except that the condition to promote a virtual call is that VPtr is the same as any of AddressPoints.
propagateIRFlagsGet the intersection (logical and) of all of the potential IR flags of each scalar operation (VL) that will be converted into a vector (I). If OpValue is non-null, we only consider operations similar to OpValue when intersecting. Flag set: NSW, NUW (if IncludeWrapFlags is true), exact, and all of fast-math.
propagateMetadataSpecifically, let Kinds = [MD_tbaa, MD_alias_scope, MD_noalias, MD_fpmath,] MD_nontemporal, MD_access_group, MD_mmra]. For K in Kinds, we get the MDNode for K from each of the elements of VL, compute their "intersection" (i.e., the most generic metadata value that covers all of the individual values), and set I's metadata for M equal to the intersection value.
recognizeBSwapOrBitReverseIdiomTry to match a bswap or bitreverse idiom.
replaceAllDbgUsesWithPoint debug users of From to To or salvage them. Use this function only when replacing all uses of From with To, with a guarantee that From is going to be deleted.
replaceAndRecursivelySimplifyReplace all uses of 'I' with 'SimpleV' and simplify the uses recursively.
replaceDbgDeclareReplaces dbg.declare record when the address it describes is replaced with a new value. If Deref is true, an additional DW_OP_deref is prepended to the expression. If Offset is non-zero, a constant displacement is added to the expression (between the optional Deref operations). Offset can be negative.
replaceDominatedUsesWithReplace each use of 'From' with 'To' if that use is dominated by the given edge. Returns the number of replacements made.
replaceDominatedUsesWithReplace each use of 'From' with 'To' if that use is dominated by the given instruction. Returns the number of replacements made.
replaceDominatedUsesWithReplace each use of 'From' with 'To' if that use is dominated by the end of the given BasicBlock. Returns the number of replacements made.
replaceDominatedUsesWithIfReplace each use of 'From' with 'To' if that use is dominated by the given instruction and the callback ShouldReplace returns true. Returns the number of replacements made.
replaceDominatedUsesWithIfReplace each use of 'From' with 'To' if that use is dominated by the end of the given BasicBlock and the callback ShouldReplace returns true. Returns the number of replacements made.
replaceDominatedUsesWithIfReplace each use of 'From' with 'To' if that use is dominated by the given edge and the callback ShouldReplace returns true. Returns the number of replacements made.
salvageDebugInfoSalvage debug records that use I before the instruction is deleted. Rewrite those uses in terms of its operands where we can, and encode the instruction's effect in the record's DIExpression. Deleting the instruction replaces any remaining debug-record uses with poison.
salvageDebugInfoForDbgValuesSalvage only the records in DbgRecords instead of finding every debug user of I. Every record must be a debug user of the instruction.
salvageDebugInfoImplGiven an instruction I and DIExpression DIExpr operating on it, append the effects of I to the DIExpression operand list Ops, or return nullptr if it cannot be salvaged. CurrentLocOps is the number of SSA values referenced by the incoming Ops.
salvageKnowledgeCalls BuildAssumeFromInst and if the resulting llvm.assume is valid insert if before I. This is usually what need to be done to salvage the knowledge contained in the instruction I. The AssumptionCache must be provided if it is available or the cache may become silently be invalid. The DominatorTree can optionally be provided to enable cross-block reasoning. This returns if a change was made.
scaleProfDataScaling the profile data attached to 'I' using the ratio of S/T.
setAtomicSyncScopeIDA helper function that sets an atomic operation's sync scope.
setBranchWeightsCreate a new branch_weights metadata node and add or overwrite a prof metadata reference to instruction I.
setExplicitlyUnknownBranchWeightsSpecify that the branch weights for this terminator cannot be known at compile time. This should only be called by passes, and never as a default behavior in e.g. MDBuilder. The goal is to use this info to validate passes do not accidentally drop profile info, and this API is called in cases where the pass explicitly cannot provide that info. Defaulting it in would hide bugs where the pass forgets to transfer over or otherwise specify profile info. Use PassName to capture the pass name (i.e. DEBUG_TYPE) for debuggability.
setExplicitlyUnknownBranchWeightsIfProfiledLike setExplicitlyUnknownBranchWeights(...), but only sets unknown branch weights in the new instruction if the parent function of the original instruction has an entry count. This is to not confuse users by injecting profile data into non-profiled functions. If F is nullptr, we will fetch the function from I.
setFittedBranchWeightsVariant of setBranchWeights where the Weights will be fit first to uint32_t by shifting right.
setInlineRemarkSet the inline-remark attribute.
setLoadStoreAlignmentA helper function that set the alignment of load or store instruction.
setUnwindEdgeToSets the unwind edge of an instruction to a particular successor.
shouldInlineReturn the cost only if the inliner should attempt to inline at the given CallSite. If we return the cost, we will emit an optimisation remark later using that cost, so we won't do so from this function. Return std::nullopt if inlining should not be attempted.
simplifyAShrInstGiven operands for a AShr, fold the result or return nulll.
simplifyAddInstGiven operands for an Add, fold the result or return null.
simplifyAndInstGiven operands for an And, fold the result or return null.
simplifyCallGiven a callsite, callee, and arguments, fold the result or return null.
simplifyConstrainedFPCallGiven a constrained FP intrinsic call, tries to compute its simplified version. Returns a simplified result or null.
simplifyExtractElementInstGiven operands for an ExtractElementInst, fold the result or return null.
simplifyExtractValueInstGiven operands for an ExtractValueInst, fold the result or return null.
simplifyFAddInstGiven operands for an FAdd, fold the result or return null.
simplifyFDivInstGiven operands for an FDiv, fold the result or return null.
simplifyFMAFMulGiven operands for the multiplication of a FMA, fold the result or return null. In contrast to simplifyFMulInst, this function will not perform simplifications whose unrounded results differ when rounded to the argument type.
simplifyFMulInstGiven operands for an FMul, fold the result or return null.
simplifyFNegInstGiven operand for an FNeg, fold the result or return null.
simplifyFRemInstGiven operands for an FRem, fold the result or return null.
simplifyFSubInstGiven operands for an FSub, fold the result or return null.
simplifyFreezeInstGiven an operand for a Freeze, see if we can fold the result. If not, this returns null.
simplifyInsertElementInstGiven operands for an InsertElement, fold the result or return null.
simplifyInsertValueInstGiven operands for an InsertValueInst, fold the result or return null.
simplifyInstructionSee if we can compute a simplified version of this instruction. If not, return null.
simplifyInstructionWithOperandsLike simplifyInstruction but the operands of I are replaced with NewOps. Returns a simplified value, or null if none was found.
simplifyLShrInstGiven operands for a LShr, fold the result or return null.
simplifyMulInstGiven operands for a Mul, fold the result or return null.
simplifyOrInstGiven operands for an Or, fold the result or return null.
simplifySDivInstGiven operands for an SDiv, fold the result or return null.
simplifySRemInstGiven operands for an SRem, fold the result or return null.
simplifySelectInstGiven operands for a SelectInst, fold the result or return null.
simplifyShlInstGiven operands for a Shl, fold the result or return null.
simplifyShuffleVectorInstGiven operands for a ShuffleVectorInst, fold the result or return null. See class ShuffleVectorInst for a description of the mask representation.
simplifySubInstGiven operands for a Sub, fold the result or return null.
simplifyUDivInstGiven operands for a UDiv, fold the result or return null.
simplifyURemInstGiven operands for a URem, fold the result or return null.
simplifyWithOpReplacedSee if V simplifies when its operand Op is replaced with RepOp. If not, return null. AllowRefinement specifies whether the simplification can be a refinement (e.g. 0 instead of poison), or whether it needs to be strictly identical. Op and RepOp can be assumed to not be poison when determining refinement.
simplifyXorInstGiven operands for an Xor, fold the result or return null.
stripNullTestReturns the inner value X if the expression has the form f(X) where f(X) == 0 if and only if X == 0, otherwise returns nullptr.
tryEnforceAlignmentIf the specified pointer points to an object that we control, try to modify the object's alignment to PrefAlign. Returns a minimum known alignment of the value after the operation, which may be lower than PrefAlign.
tryPromoteCallTry to promote (devirtualize) a virtual call on an Alloca. Return true on success.
updateLoopMetadataDebugLocationsUpdate the debug locations contained within the MD_loop metadata attached to the instruction I, if one exists. Updater is applied to Metadata operand in the MD_loop metadata: the returned value is included in the updated loop metadata node if it is non-null.
versionCallSitePredicate and clone the given call site.
willNotFreeBetweenReturns true, if no instruction between Assume and CtxI may free (including through synchronization).
wouldInstructionBeTriviallyDeadReturn true if the result produced by the instruction would have no side effects if it was not used. This is equivalent to checking whether isInstructionTriviallyDead would be true if the use count was 0.
AA::getWithTypeTry to convert V to type Ty without introducing new instructions.
AA::isValidInScopeReturn true if V is a valid value in Scope, that is a constant or an instruction/argument of Scope.
PatternMatch::m_AnyIntrinsicMatch any intrinsic call, capturing it if we match.
PatternMatch::m_DeferredLike m_Specific(), but works if the specific value to match is determined as part of the same match() expression. For example: m_Add(m_Value(X), m_Specific(X)) is incorrect, because m_Specific() will bind X before the pattern match starts. m_Add(m_Value(X), m_Deferred(X)) is correct, and will check against whichever value m_Value(X) populated.
PatternMatch::m_InstructionMatch an instruction, capturing it if we match.
PatternMatch::m_InstructionMatch against the nested pattern, and capture the instruction if we match.
PatternMatch::m_SpecificMatch if we have a specific specified value.
PatternMatch::m_ValueMatch against the nested pattern, and capture the value if we match.
PatternMatch::m_ValueMatch against the nested pattern, and capture the value if we match.
PatternMatch::m_ValueMatch a value, capturing it if we match.
VFABI::getVectorVariantNamesPopulates a set of strings representing the Vector Function ABI variants associated to the CallInst CI. If the CI does not contain the vector-function-abi-variant attribute, we return without populating VariantMappings, i.e. callers of getVectorVariantNames need not check for the presence of the attribute (see InjectTLIMappings).
VFABI::setVectorVariantNamesOverwrite the Vector Function ABI variants attribute with the names provide in VariantMappings.
VNCoercion::canCoerceMustAliasedValueToLoadReturn true if CoerceAvailableValueToLoadType would succeed if it was called.
VNCoercion::coerceAvailableValueToLoadTypeIf we saw a store of a value to memory, and then a load from a must-aliased pointer of a different type, try to coerce the stored value to the loaded type. LoadedTy is the type of the load we want to replace. IRB is IRBuilder used to insert new instructions.
VNCoercion::getValueForLoadIf analyzeLoadFromClobberingStore/Load returned an offset, this function can be used to actually perform the extraction of the bits from the store. It inserts instructions to do so at InsertPt, and returns the extracted value.
at::deleteAssignmentMarkersDelete the llvm.dbg.assign intrinsics linked to Inst.
at::getDVRAssignmentMarkersReturn a range of dbg_assign records for which Inst performs the assignment they encode.
instrumentor::evaluateFilterEvaluate the filter expression against the current instrumentation opportunity. Returns true if the filter passes (or is empty), false otherwise. Dynamic values (non-constants) are assumed to pass.
memprof::addAmbiguousAttributeAdds an "ambiguous" memprof attribute to call with a matched allocation profile but that we haven't yet been able to disambiguate.
memprof::removeAnyExistingAmbiguousAttributeRemoves any existing "ambiguous" memprof attribute. Called before we apply a specific allocation type such as "cold", "notcold", or "hot".
misexpect::checkBackendInstrumentationcheckBackendInstrumentation - compares PGO counters to the thresholds used for llvm.expect and warns if the PGO counters are outside of the expected range. It extracts the expected weights from the MD_prof weights attached to the instruction, which are assumed to come from lowered llvm.expect intrinsics. The RealWeights parameter and the extracted expected weights are then passed to verifyMisexpect() for verification
misexpect::checkExpectAnnotationscheckExpectAnnotations - compares PGO counters to the thresholds used for llvm.expect and warns if the PGO counters are outside of the expected range. It extracts the expected weights from the MD_prof weights attached to the instruction, which are assumed to come from lowered llvm.expect intrinsics. The RealWeights parameter and the extracted expected weights are then passed to verifyMisexpect() for verification. It is a thin wrapper around the checkFrontendInstrumentation and checkBackendInstrumentation APIs
misexpect::checkFrontendInstrumentationcheckFrontendInstrumentation - compares PGO counters to the thresholds used for llvm.expect and warns if the PGO counters are outside of the expected range. It extracts the expected weights from the MD_prof weights attached to the instruction, which are assumed to come from profiling data attached by the frontend prior to llvm.expect intrinsic lowering. The ExpectedWeights parameter and the extracted real weights are then passed to verifyMisexpect() for verification
misexpect::verifyMisExpectveryifyMisExpect - compares RealWeights to the thresholds used for llvm.expect and warns if the PGO counters are outside of the expected range.
objcarc::GetARCInstKindMap V to its ARCInstKind equivalence class.
objcarc::GetArgRCIdentityRootAssuming the given instruction is one of the special calls such as objc_retain or objc_release, return the RCIdentity root of the argument of the call.
objcarc::GetBasicARCInstKindDetermine which objc runtime call instruction class V belongs to.
objcarc::GetCallSiteClassHelper for GetARCInstKind. Determines what kind of construct CS is.
objcarc::GetRCIdentityRootThe RCIdentity root of a value V is a dominating value U for which retaining or releasing U is equivalent to retaining or releasing V. In other words, ARC operations on V are equivalent to ARC operations on U.
objcarc::GetRCIdentityRootHelper which calls const Value *GetRCIdentityRoot(const Value *V) and just casts away the const of the result. For documentation about what an RCIdentityRoot (and by extension GetRCIdentityRoot is) look at that function.
objcarc::GetUnderlyingObjCPtrThis is a wrapper around getUnderlyingObject which also knows how to look through objc_retain and objc_autorelease calls, which we know to return their argument verbatim.
objcarc::GetUnderlyingObjCPtrCachedA wrapper for GetUnderlyingObjCPtr used for results memoization.
objcarc::IsObjCIdentifiedObjectReturn true if this value refers to a distinct and identifiable object.
objcarc::IsPotentialRetainableObjPtrTest whether the given value is possible a retainable object pointer.
objcarc::attachedCallOpBundleNeedsMarkerThis function determines whether the clang_arc_attachedcall should be emitted with or without the marker. Concretely, this is the difference between: objc_retainAutoreleasedReturnValue and objc_claimAutoreleasedReturnValue retainRV (and unsafeClaimRV) requires a marker, but claimRV does not.
objcarc::getAttachedARCFunctionThis function returns operand bundle clang_arc_attachedcall's argument, which is the address of the ARC runtime function.
objcarc::getAttachedARCFunctionKindThis function returns the ARCInstKind of the function attached to operand bundle clang_arc_attachedcall. It returns std::nullopt if the call doesn't have the operand bundle or the operand is null. Otherwise it returns either RetainRV or UnsafeClaimRV.