llvm::MemoryAccess

Synopsis

Declared in <llvm/Analysis/MemorySSA.h>

class MemoryAccess
    : public DerivedUser
    , public ilist_node<MemoryAccess, ilist_tag<MSSAHelpers::AllAccessTag>>
    , public ilist_node<MemoryAccess, ilist_tag<MSSAHelpers::DefsOnlyTag>>

Base Classes

NameDescription
DerivedUserExtension point for the Value hierarchy. All classes outside of lib/IR that wish to inherit from User should instead inherit from DerivedUser instead. Inheriting from this class is discouraged.
ilist_node<MemoryAccess, ilist_tag<MSSAHelpers::AllAccessTag>>An intrusive list node.
ilist_node<MemoryAccess, ilist_tag<MSSAHelpers::DefsOnlyTag>>An intrusive list node.

Types

NameDescription
const_value_op_iterator
value_op_iterator Iterator for directly iterating over the operand Values.

Type Aliases

NameDescription
AllAccessType
DefsOnlyType
const_iterator
const_op_iterator
const_op_range
const_use_iterator
const_user_iterator
iterator The user iterators for a memory access
op_iterator
op_range
use_iterator
user_iterator

Enums

NameDescription
ValueTy Concrete subclass of this.

Member Functions

NameDescription
MemoryAccess [constructor] [deleted]Copy constructor
operator= Assignment operators
DoPHITranslation Translate PHI node to its predecessor from the given basic block.
addUse This method should only be used by the Use class.
assertModuleIsMaterialized
assertModuleIsMaterializedImpl
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.
defs_begin This iterator walks over all of the defs in a given MemoryAccess. For MemoryPhi nodes, this walks arguments. For MemoryUse/MemoryDef, this walks the defining access.
defs_end
deleteValue Delete a pointer to a generic Value.
dropAllReferences Drop all references to operands.
dropDroppableUses Remove every uses that can safely be removed.
dropDroppableUsesIn Remove every use of this value in User that can safely be removed.
dump
getBlock
getContext All values hold a context through their type.
getDefsIterator
getDescriptor Returns the descriptor co-allocated with this User instance.
getIterator Get the iterators for the all access list and the defs only list We default to the all access list.
getName Return a constant reference to the value's name.
getNameOrAsOperand
getNumOperands
getNumUses This method computes the number of uses of this Value.
getOperand
getOperandList
getOperandUse
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.
getRawSubclassOptionalData Return the raw optional flags value contained in this value.
getReverseDefsIterator
getReverseIterator
getSingleUndroppableUse Return true if there is exactly one use of this value that cannot be dropped.
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
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
hasOneUse Return true if there is exactly one use of this value.
hasOneUser Return true if there is exactly one user of this value.
hasUseList Check if this Value has a use-list.
hasValueHandle Return true if there is a value handle associated with this value.
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.
isSwiftError Return true if this value is a swifterror value.
isUsedByMetadata Return true if there is metadata referencing this value.
isUsedInBasicBlock Check if this value is used in the specified basic block.
materialized_use_begin
materialized_use_empty
materialized_user_begin
materialized_users
materialized_uses
mutateType Mutate the type of this Value to be of the specified type.
op_begin
op_end
operand_values
operands
operator delete Delete operators
operator new [deleted]
print Implement operator<< on Value. @{
printAsOperand Print the name of this Value out to the specified raw_ostream.
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.
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.
reverseUseList Reverse the use-list.
setName Change the name of the value.
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.
setOperand
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.
takeName Transfer the name from V to this value.
use_begin
use_empty
use_end
user_back
user_begin
user_empty
user_end
users
uses
value_op_begin
value_op_end

Static Member Functions

NameDescription
classof
dropDroppableUse Remove the droppable use U.

Static Data Members

NameDescription
MaxAlignmentExponent The maximum alignment for instructions.
MaximumAlignment

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
DeleteValueTy

Protected Enums

NameDescription
Unnamed enum The number of operands in the subclass.

Protected Member Functions

NameDescription
MemoryAccess [constructor]
~MemoryAccess [destructor]Destructor
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.
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.
getID Used for debugging and tracking things about MemoryAccesses. Guaranteed unique among MemoryAccesses, no guarantees otherwise.
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.
getSubclassDataFromValue
growHungoffUses Grow the number of hung off uses. Note that allocHungoffUses should be called if there are no uses.
operator new New operators
setBlock Used by MemorySSA to change the block of a MemoryAccess when it is moved.
setMetadata Set a particular kind of metadata attachment.
setValueSubclassData

Protected Static Member Functions

Name
OpFrom

Protected Data Members

NameDescription
HasDescriptor
HasHungOffUses
HasName
IsUsedByMD
NumUserOperands
SubclassOptionalData Hold arbitary subclass data.

Friends

NameDescription
llvm::MemoryUseOrDefClass that has the common methods + fields of memory uses/defs. It's a little awkward to have, but there are many cases where we want either a use or def, and there are many cases where uses are needed (defs aren't acceptable), and vice-versa.
llvm::MemoryUseRepresents read-only accesses to memory
llvm::MemorySSAEncapsulates MemorySSA, including all data associated with memory accesses.
llvm::MemoryPhiRepresents phi nodes for memory accesses.
llvm::MemoryDefRepresents a read-write access to memory, whether it is a must-alias, or a may-alias.

Non-Member Functions

NameDescription
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
getAllocationFamilyIf a function is part of an allocation family (e.g. malloc/realloc/calloc/free), return the identifier for its family of functions.
getBaseObjectSizeLike getObjectSize(), but only returns the size of base objects (like allocas, global variables and allocator calls) and std::nullopt otherwise. Requires ExactSizeFromOffset mode.
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.
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.
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.
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.
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.
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.
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).
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.
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.
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)
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.
isNoAliasCallReturn true if this pointer is returned by a noalias function.
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.
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.
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.
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.
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.
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.
possiblyDemandedEltsInMaskGiven a mask vector of the form <Y x i1>, return an APInt (of bitwidth Y) for each lane which may be active.
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.
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.
setLoadStoreAlignmentA helper function that set the alignment of load or store instruction.
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.
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.
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.
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_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_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.
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.
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.
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::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.

Derived Classes

NameDescription
MemoryPhi Represents phi nodes for memory accesses.
MemoryUseOrDef Class that has the common methods + fields of memory uses/defs. It's a little awkward to have, but there are many cases where we want either a use or def, and there are many cases where uses are needed (defs aren't acceptable), and vice-versa.