LLVM 22.0.0git
|
#include "llvm/IR/Instruction.h"
Public Types | |
enum | OperationEquivalenceFlags { CompareIgnoringAlignment = 1 << 0 , CompareUsingScalarTypes = 1 << 1 , CompareUsingIntersectedAttrs = 1 << 2 } |
When checking for operation equivalence (using isSameOperationAs) it is sometimes useful to ignore certain attributes. More... | |
enum | TermOps |
enum | UnaryOps |
enum | BinaryOps |
enum | MemoryOps |
enum | CastOps |
enum | FuncletPadOps |
enum | OtherOps |
using | InstListType = SymbolTableList< Instruction, ilist_iterator_bits< true >, ilist_parent< BasicBlock > > |
![]() | |
using | op_iterator = Use * |
using | const_op_iterator = const Use * |
using | op_range = iterator_range< op_iterator > |
using | const_op_range = iterator_range< const_op_iterator > |
![]() | |
enum | ValueTy |
Concrete subclass of this. More... | |
using | use_iterator = use_iterator_impl< Use > |
using | const_use_iterator = use_iterator_impl< const Use > |
using | user_iterator = user_iterator_impl< User > |
using | const_user_iterator = user_iterator_impl< const User > |
Public Member Functions | |
LLVM_ABI iterator_range< simple_ilist< DbgRecord >::iterator > | cloneDebugInfoFrom (const Instruction *From, std::optional< simple_ilist< DbgRecord >::iterator > FromHere=std::nullopt, bool InsertAtHead=false) |
Clone any debug-info attached to From onto this instruction. | |
iterator_range< simple_ilist< DbgRecord >::iterator > | getDbgRecordRange () const |
Return a range over the DbgRecords attached to this instruction. | |
LLVM_ABI std::optional< simple_ilist< DbgRecord >::iterator > | getDbgReinsertionPosition () |
Return an iterator to the position of the "Next" DbgRecord after this instruction, or std::nullopt. | |
LLVM_ABI bool | hasDbgRecords () const |
Returns true if any DbgRecords are attached to this instruction. | |
LLVM_ABI void | adoptDbgRecords (BasicBlock *BB, InstListType::iterator It, bool InsertAtHead) |
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. | |
LLVM_ABI void | dropDbgRecords () |
Erase any DbgRecords attached to this instruction. | |
LLVM_ABI void | dropOneDbgRecord (DbgRecord *I) |
Erase a single DbgRecord I that is attached to this instruction. | |
LLVM_ABI void | handleMarkerRemoval () |
Handle the debug-info implications of this instruction being removed. | |
Instruction (const Instruction &)=delete | |
Instruction & | operator= (const Instruction &)=delete |
Instruction * | user_back () |
Specialize the methods defined in Value, as we know that an instruction can only be used by other instructions. | |
const Instruction * | user_back () const |
LLVM_ABI const Module * | getModule () const |
Return the module owning the function this instruction belongs to or nullptr it the function does not have a module. | |
Module * | getModule () |
LLVM_ABI const Function * | getFunction () const |
Return the function this instruction belongs to. | |
Function * | getFunction () |
LLVM_ABI const DataLayout & | getDataLayout () const |
Get the data layout of the module this instruction belongs to. | |
LLVM_ABI void | removeFromParent () |
This method unlinks 'this' from the containing basic block, but does not delete it. | |
LLVM_ABI InstListType::iterator | eraseFromParent () |
This method unlinks 'this' from the containing basic block and deletes it. | |
LLVM_ABI | LLVM_DEPRECATED ("Use iterators as instruction positions", "") void insertBefore(Instruction *InsertPos) |
Insert an unlinked instruction into a basic block immediately before the specified instruction. | |
LLVM_ABI void | insertBefore (InstListType::iterator InsertPos) |
Insert an unlinked instruction into a basic block immediately before the specified position. | |
LLVM_ABI void | insertAfter (Instruction *InsertPos) |
Insert an unlinked instruction into a basic block immediately after the specified instruction. | |
LLVM_ABI void | insertAfter (InstListType::iterator InsertPos) |
Insert an unlinked instruction into a basic block immediately after the specified position. | |
LLVM_ABI InstListType::iterator | insertInto (BasicBlock *ParentBB, InstListType::iterator It) |
Inserts an unlinked instruction into ParentBB at position It and returns the iterator of the inserted instruction. | |
LLVM_ABI void | insertBefore (BasicBlock &BB, InstListType::iterator InsertPos) |
LLVM_ABI | LLVM_DEPRECATED ("Use iterators as instruction positions", "") void moveBefore(Instruction *MovePos) |
Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right before MovePos. | |
LLVM_ABI void | moveBefore (InstListType::iterator InsertPos) |
Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right before MovePos. | |
LLVM_ABI void | moveBeforePreserving (InstListType::iterator MovePos) |
Perform a moveBefore operation, while signalling that the caller intends to preserve the original ordering of instructions. | |
LLVM_ABI void | moveBeforePreserving (BasicBlock &BB, InstListType::iterator I) |
Perform a moveBefore operation, while signalling that the caller intends to preserve the original ordering of instructions. | |
LLVM_ABI | LLVM_DEPRECATED ("Use iterators as instruction positions", "") void moveBeforePreserving(Instruction *MovePos) |
Perform a moveBefore operation, while signalling that the caller intends to preserve the original ordering of instructions. | |
LLVM_ABI void | moveBefore (BasicBlock &BB, InstListType::iterator I) |
Unlink this instruction and insert into BB before I. | |
LLVM_ABI void | moveAfter (Instruction *MovePos) |
Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right after MovePos. | |
LLVM_ABI void | moveAfter (InstListType::iterator MovePos) |
Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right after MovePos. | |
LLVM_ABI void | moveAfterPreserving (Instruction *MovePos) |
See moveBeforePreserving . | |
LLVM_ABI bool | comesBefore (const Instruction *Other) const |
Given an instruction Other in the same basic block as this instruction, return true if this instruction comes before Other. | |
LLVM_ABI std::optional< InstListType::iterator > | getInsertionPointAfterDef () |
Get the first insertion point at which the result of this instruction is defined. | |
unsigned | getOpcode () const |
Returns a member of one of the enums like Instruction::Add. | |
const char * | getOpcodeName () const |
bool | isTerminator () const |
bool | isUnaryOp () const |
bool | isBinaryOp () const |
bool | isIntDivRem () const |
bool | isFPDivRem () const |
bool | isShift () const |
bool | isCast () const |
bool | isFuncletPad () const |
bool | isSpecialTerminator () const |
LLVM_ABI bool | isOnlyUserOfAnyOperand () |
It checks if this instruction is the only user of at least one of its operands. | |
bool | isLogicalShift () const |
Return true if this is a logical shift left or a logical shift right. | |
bool | isArithmeticShift () const |
Return true if this is an arithmetic shift right. | |
bool | isBitwiseLogicOp () const |
Return true if this is and/or/xor. | |
bool | hasMetadata () const |
Return true if this instruction has any metadata attached to it. | |
LLVM_ABI bool | hasNonDebugLocLoopMetadata () const |
bool | hasMetadataOtherThanDebugLoc () const |
Return true if this instruction has metadata attached to it other than a debug location. | |
bool | hasMetadata (unsigned KindID) const |
Return true if this instruction has the given type of metadata attached. | |
bool | hasMetadata (StringRef Kind) const |
Return true if this instruction has the given type of metadata attached. | |
MDNode * | getMetadata (unsigned KindID) const |
Get the metadata of given kind attached to this Instruction. | |
MDNode * | getMetadata (StringRef Kind) const |
Get the metadata of given kind attached to this Instruction. | |
void | getAllMetadata (SmallVectorImpl< std::pair< unsigned, MDNode * > > &MDs) const |
Get all metadata attached to this Instruction. | |
void | getAllMetadataOtherThanDebugLoc (SmallVectorImpl< std::pair< unsigned, MDNode * > > &MDs) const |
This does the same thing as getAllMetadata, except that it filters out the debug location. | |
LLVM_ABI void | setMetadata (unsigned KindID, MDNode *Node) |
Set the metadata of the specified kind to the specified node. | |
LLVM_ABI void | setMetadata (StringRef Kind, MDNode *Node) |
LLVM_ABI void | copyMetadata (const Instruction &SrcInst, ArrayRef< unsigned > WL=ArrayRef< unsigned >()) |
Copy metadata from SrcInst to this instruction. | |
LLVM_ABI void | eraseMetadataIf (function_ref< bool(unsigned, MDNode *)> Pred) |
Erase all metadata that matches the predicate. | |
LLVM_ABI void | 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. | |
LLVM_ABI void | addAnnotationMetadata (StringRef Annotation) |
Adds an !annotation metadata node with Annotation to this instruction. | |
LLVM_ABI void | addAnnotationMetadata (SmallVector< StringRef > Annotations) |
Adds an !annotation metadata node with an array of Annotations as a tuple to this instruction. | |
LLVM_ABI AAMDNodes | getAAMetadata () const |
Returns the AA metadata for this instruction. | |
LLVM_ABI void | setAAMetadata (const AAMDNodes &N) |
Sets the AA metadata on this instruction from the AAMDNodes structure. | |
LLVM_ABI void | setNoSanitizeMetadata () |
Sets the nosanitize metadata on this instruction. | |
LLVM_ABI bool | extractProfTotalWeight (uint64_t &TotalVal) const |
Retrieve total raw weight values of a branch. | |
void | setDebugLoc (DebugLoc Loc) |
Set the debug location information for this instruction. | |
const DebugLoc & | getDebugLoc () const |
Return the debug location for this node as a DebugLoc. | |
LLVM_ABI const DebugLoc & | getStableDebugLoc () const |
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. | |
LLVM_ABI void | setHasNoUnsignedWrap (bool b=true) |
Set or clear the nuw flag on this instruction, which must be an operator which supports this flag. | |
LLVM_ABI void | setHasNoSignedWrap (bool b=true) |
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag. | |
LLVM_ABI void | setIsExact (bool b=true) |
Set or clear the exact flag on this instruction, which must be an operator which supports this flag. | |
LLVM_ABI void | setNonNeg (bool b=true) |
Set or clear the nneg flag on this instruction, which must be a zext instruction. | |
LLVM_ABI bool | hasNoUnsignedWrap () const LLVM_READONLY |
Determine whether the no unsigned wrap flag is set. | |
LLVM_ABI bool | hasNoSignedWrap () const LLVM_READONLY |
Determine whether the no signed wrap flag is set. | |
LLVM_ABI bool | hasNonNeg () const LLVM_READONLY |
Determine whether the the nneg flag is set. | |
LLVM_ABI bool | hasPoisonGeneratingFlags () const LLVM_READONLY |
Return true if this operator has flags which may cause this instruction to evaluate to poison despite having non-poison inputs. | |
LLVM_ABI void | dropPoisonGeneratingFlags () |
Drops flags that may cause this instruction to evaluate to poison despite having non-poison inputs. | |
LLVM_ABI bool | hasPoisonGeneratingMetadata () const LLVM_READONLY |
Return true if this instruction has poison-generating metadata. | |
LLVM_ABI void | dropPoisonGeneratingMetadata () |
Drops metadata that may generate poison. | |
LLVM_ABI bool | hasPoisonGeneratingReturnAttributes () const LLVM_READONLY |
Return true if this instruction has poison-generating attribute. | |
LLVM_ABI void | dropPoisonGeneratingReturnAttributes () |
Drops return attributes that may generate poison. | |
bool | hasPoisonGeneratingAnnotations () const |
Return true if this instruction has poison-generating flags, return attributes or metadata. | |
void | dropPoisonGeneratingAnnotations () |
Drops flags, return attributes and metadata that may generate poison. | |
LLVM_ABI void | dropUBImplyingAttrsAndUnknownMetadata (ArrayRef< unsigned > KnownIDs={}) |
This function drops non-debug unknown metadata (through dropUnknownNonDebugMetadata). | |
LLVM_ABI void | dropUBImplyingAttrsAndMetadata (ArrayRef< unsigned > Keep={}) |
Drop any attributes or metadata that can cause immediate undefined behavior. | |
LLVM_ABI bool | hasUBImplyingAttrs () const LLVM_READONLY |
Return true if this instruction has UB-implying attributes that can cause immediate undefined behavior. | |
LLVM_ABI bool | isExact () const LLVM_READONLY |
Determine whether the exact flag is set. | |
LLVM_ABI void | setFast (bool B) |
Set or clear all fast-math-flags on this instruction, which must be an operator which supports this flag. | |
LLVM_ABI void | setHasAllowReassoc (bool B) |
Set or clear the reassociation flag on this instruction, which must be an operator which supports this flag. | |
LLVM_ABI void | setHasNoNaNs (bool B) |
Set or clear the no-nans flag on this instruction, which must be an operator which supports this flag. | |
LLVM_ABI void | setHasNoInfs (bool B) |
Set or clear the no-infs flag on this instruction, which must be an operator which supports this flag. | |
LLVM_ABI void | setHasNoSignedZeros (bool B) |
Set or clear the no-signed-zeros flag on this instruction, which must be an operator which supports this flag. | |
LLVM_ABI void | setHasAllowReciprocal (bool B) |
Set or clear the allow-reciprocal flag on this instruction, which must be an operator which supports this flag. | |
LLVM_ABI void | setHasAllowContract (bool B) |
Set or clear the allow-contract flag on this instruction, which must be an operator which supports this flag. | |
LLVM_ABI void | setHasApproxFunc (bool B) |
Set or clear the approximate-math-functions flag on this instruction, which must be an operator which supports this flag. | |
LLVM_ABI void | setFastMathFlags (FastMathFlags FMF) |
Convenience function for setting multiple fast-math flags on this instruction, which must be an operator which supports these flags. | |
LLVM_ABI void | copyFastMathFlags (FastMathFlags FMF) |
Convenience function for transferring all fast-math flag values to this instruction, which must be an operator which supports these flags. | |
LLVM_ABI bool | isFast () const LLVM_READONLY |
Determine whether all fast-math-flags are set. | |
LLVM_ABI bool | hasAllowReassoc () const LLVM_READONLY |
Determine whether the allow-reassociation flag is set. | |
LLVM_ABI bool | hasNoNaNs () const LLVM_READONLY |
Determine whether the no-NaNs flag is set. | |
LLVM_ABI bool | hasNoInfs () const LLVM_READONLY |
Determine whether the no-infs flag is set. | |
LLVM_ABI bool | hasNoSignedZeros () const LLVM_READONLY |
Determine whether the no-signed-zeros flag is set. | |
LLVM_ABI bool | hasAllowReciprocal () const LLVM_READONLY |
Determine whether the allow-reciprocal flag is set. | |
LLVM_ABI bool | hasAllowContract () const LLVM_READONLY |
Determine whether the allow-contract flag is set. | |
LLVM_ABI bool | hasApproxFunc () const LLVM_READONLY |
Determine whether the approximate-math-functions flag is set. | |
LLVM_ABI FastMathFlags | getFastMathFlags () const LLVM_READONLY |
Convenience function for getting all the fast-math flags, which must be an operator which supports these flags. | |
LLVM_ABI void | copyFastMathFlags (const Instruction *I) |
Copy I's fast-math flags. | |
LLVM_ABI void | copyIRFlags (const Value *V, bool IncludeWrapFlags=true) |
Convenience method to copy supported exact, fast-math, and (optionally) wrapping flags from V to this instruction. | |
LLVM_ABI void | andIRFlags (const Value *V) |
Logical 'and' of any supported wrapping, exact, and fast-math flags of V and this instruction. | |
LLVM_ABI void | applyMergedLocation (DebugLoc LocA, DebugLoc LocB) |
Merge 2 debug locations and apply it to the Instruction. | |
LLVM_ABI void | updateLocationAfterHoist () |
Updates the debug location given that the instruction has been hoisted from a block to a predecessor of that block. | |
LLVM_ABI void | dropLocation () |
Drop the instruction's debug location. | |
LLVM_ABI void | mergeDIAssignID (ArrayRef< const Instruction * > SourceInstructions) |
Merge the DIAssignID metadata from this instruction and those attached to instructions in SourceInstructions . | |
LLVM_ABI bool | isAssociative () const LLVM_READONLY |
Return true if the instruction is associative: | |
LLVM_ABI bool | isCommutative () const LLVM_READONLY |
Return true if the instruction is commutative: | |
bool | isIdempotent () const |
Return true if the instruction is idempotent: | |
bool | isNilpotent () const |
Return true if the instruction is nilpotent: | |
LLVM_ABI bool | mayWriteToMemory () const LLVM_READONLY |
Return true if this instruction may modify memory. | |
LLVM_ABI bool | mayReadFromMemory () const LLVM_READONLY |
Return true if this instruction may read memory. | |
bool | mayReadOrWriteMemory () const |
Return true if this instruction may read or write memory. | |
LLVM_ABI bool | isAtomic () const LLVM_READONLY |
Return true if this instruction has an AtomicOrdering of unordered or higher. | |
LLVM_ABI bool | hasAtomicLoad () const LLVM_READONLY |
Return true if this atomic instruction loads from memory. | |
LLVM_ABI bool | hasAtomicStore () const LLVM_READONLY |
Return true if this atomic instruction stores to memory. | |
LLVM_ABI bool | isVolatile () const LLVM_READONLY |
Return true if this instruction has a volatile memory access. | |
LLVM_ABI Type * | getAccessType () const LLVM_READONLY |
Return the type this instruction accesses in memory, if any. | |
LLVM_ABI bool | mayThrow (bool IncludePhaseOneUnwind=false) const LLVM_READONLY |
Return true if this instruction may throw an exception. | |
bool | isFenceLike () const |
Return true if this instruction behaves like a memory fence: it can load or store to memory location without being given a memory location. | |
LLVM_ABI bool | mayHaveSideEffects () const LLVM_READONLY |
Return true if the instruction may have side effects. | |
LLVM_ABI bool | isSafeToRemove () const LLVM_READONLY |
Return true if the instruction can be removed if the result is unused. | |
LLVM_ABI bool | willReturn () const LLVM_READONLY |
Return true if the instruction will return (unwinding is considered as a form of returning control flow here). | |
bool | isEHPad () const |
Return true if the instruction is a variety of EH-block. | |
LLVM_ABI bool | isLifetimeStartOrEnd () const LLVM_READONLY |
Return true if the instruction is a llvm.lifetime.start or llvm.lifetime.end marker. | |
LLVM_ABI bool | isLaunderOrStripInvariantGroup () const LLVM_READONLY |
Return true if the instruction is a llvm.launder.invariant.group or llvm.strip.invariant.group. | |
LLVM_ABI bool | isDebugOrPseudoInst () const LLVM_READONLY |
Return true if the instruction is a DbgInfoIntrinsic or PseudoProbeInst. | |
LLVM_ABI Instruction * | clone () const |
Create a copy of 'this' instruction that is identical in all ways except the following: | |
LLVM_ABI bool | isIdenticalTo (const Instruction *I) const LLVM_READONLY |
Return true if the specified instruction is exactly identical to the current one. | |
LLVM_ABI bool | isIdenticalToWhenDefined (const Instruction *I, bool IntersectAttrs=false) const LLVM_READONLY |
This is like isIdenticalTo, except that it ignores the SubclassOptionalData flags, which may specify conditions under which the instruction's result is undefined. | |
LLVM_ABI bool | isSameOperationAs (const Instruction *I, unsigned flags=0) const LLVM_READONLY |
This function determines if the specified instruction executes the same operation as the current one. | |
LLVM_ABI bool | hasSameSpecialState (const Instruction *I2, bool IgnoreAlignment=false, bool IntersectAttrs=false) const LLVM_READONLY |
This function determines if the speficied instruction has the same "special" characteristics as the current one. | |
LLVM_ABI bool | isUsedOutsideOfBlock (const BasicBlock *BB) const LLVM_READONLY |
Return true if there are any uses of this instruction in blocks other than the specified block. | |
LLVM_ABI unsigned | getNumSuccessors () const LLVM_READONLY |
Return the number of successors that this instruction has. | |
LLVM_ABI BasicBlock * | getSuccessor (unsigned Idx) const LLVM_READONLY |
Return the specified successor. This instruction must be a terminator. | |
LLVM_ABI void | setSuccessor (unsigned Idx, BasicBlock *BB) |
Update the specified successor to point at the provided block. | |
LLVM_ABI void | replaceSuccessorWith (BasicBlock *OldBB, BasicBlock *NewBB) |
Replace specified successor OldBB to point at the provided block. | |
LLVM_ABI void | dropUnknownNonDebugMetadata (ArrayRef< unsigned > KnownIDs={}) |
Drop all unknown metadata except for debug locations. | |
![]() | |
User (const User &)=delete | |
LLVM_ABI void | operator delete (void *Usr) |
Free memory allocated for User and Use objects. | |
void | operator delete (void *Usr, HungOffOperandsAllocMarker) |
Placement delete - required by std, called if the ctor throws. | |
void | operator delete (void *Usr, IntrusiveOperandsAllocMarker) |
Placement delete - required by std, called if the ctor throws. | |
void | operator delete (void *Usr, IntrusiveOperandsAndDescriptorAllocMarker) |
Placement delete - required by std, called if the ctor throws. | |
const Use * | getOperandList () const |
Use * | getOperandList () |
Value * | getOperand (unsigned i) const |
void | setOperand (unsigned i, Value *Val) |
const Use & | getOperandUse (unsigned i) const |
Use & | getOperandUse (unsigned i) |
unsigned | getNumOperands () const |
LLVM_ABI ArrayRef< const uint8_t > | getDescriptor () const |
Returns the descriptor co-allocated with this User instance. | |
LLVM_ABI MutableArrayRef< uint8_t > | getDescriptor () |
Returns the descriptor co-allocated with this User instance. | |
void | setNumHungOffUseOperands (unsigned NumOps) |
Subclasses with hung off uses need to manage the operand count themselves. | |
LLVM_ABI bool | isDroppable () const |
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. | |
op_iterator | op_begin () |
const_op_iterator | op_begin () const |
op_iterator | op_end () |
const_op_iterator | op_end () const |
op_range | operands () |
const_op_range | operands () const |
value_op_iterator | value_op_begin () |
value_op_iterator | value_op_end () |
iterator_range< value_op_iterator > | operand_values () |
const_value_op_iterator | value_op_begin () const |
const_value_op_iterator | value_op_end () const |
iterator_range< const_value_op_iterator > | operand_values () const |
void | dropAllReferences () |
Drop all references to operands. | |
LLVM_ABI bool | replaceUsesOfWith (Value *From, Value *To) |
Replace uses of one Value with another. | |
![]() | |
Value (const Value &)=delete | |
Value & | operator= (const Value &)=delete |
LLVM_ABI void | deleteValue () |
Delete a pointer to a generic Value. | |
LLVM_ABI void | dump () const |
Support for debugging, callable in GDB: V->dump() | |
Type * | getType () const |
All values are typed, get the type of this value. | |
LLVM_ABI LLVMContext & | getContext () const |
All values hold a context through their type. | |
bool | hasName () const |
LLVM_ABI ValueName * | getValueName () const |
LLVM_ABI void | setValueName (ValueName *VN) |
LLVM_ABI StringRef | getName () const |
Return a constant reference to the value's name. | |
LLVM_ABI void | setName (const Twine &Name) |
Change the name of the value. | |
LLVM_ABI void | takeName (Value *V) |
Transfer the name from V to this value. | |
LLVM_ABI std::string | getNameOrAsOperand () const |
LLVM_ABI void | replaceAllUsesWith (Value *V) |
Change all uses of this to point to a new Value. | |
LLVM_ABI void | replaceNonMetadataUsesWith (Value *V) |
Change non-metadata uses of this to point to a new Value. | |
LLVM_ABI void | replaceUsesWithIf (Value *New, llvm::function_ref< bool(Use &U)> ShouldReplace) |
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. | |
LLVM_ABI void | replaceUsesOutsideBlock (Value *V, BasicBlock *BB) |
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. | |
LLVM_ABI void | assertModuleIsMaterializedImpl () const |
void | assertModuleIsMaterialized () const |
bool | hasUseList () const |
Check if this Value has a use-list. | |
bool | use_empty () const |
bool | materialized_use_empty () const |
use_iterator | materialized_use_begin () |
const_use_iterator | materialized_use_begin () const |
use_iterator | use_begin () |
const_use_iterator | use_begin () const |
use_iterator | use_end () |
const_use_iterator | use_end () const |
iterator_range< use_iterator > | materialized_uses () |
iterator_range< const_use_iterator > | materialized_uses () const |
iterator_range< use_iterator > | uses () |
iterator_range< const_use_iterator > | uses () const |
bool | user_empty () const |
user_iterator | materialized_user_begin () |
const_user_iterator | materialized_user_begin () const |
user_iterator | user_begin () |
const_user_iterator | user_begin () const |
user_iterator | user_end () |
const_user_iterator | user_end () const |
User * | user_back () |
const User * | user_back () const |
iterator_range< user_iterator > | materialized_users () |
iterator_range< const_user_iterator > | materialized_users () const |
iterator_range< user_iterator > | users () |
iterator_range< const_user_iterator > | users () const |
bool | hasOneUse () const |
Return true if there is exactly one use of this value. | |
LLVM_ABI bool | hasNUses (unsigned N) const |
Return true if this Value has exactly N uses. | |
LLVM_ABI bool | hasNUsesOrMore (unsigned N) const |
Return true if this value has N uses or more. | |
LLVM_ABI bool | hasOneUser () const |
Return true if there is exactly one user of this value. | |
LLVM_ABI Use * | getSingleUndroppableUse () |
Return true if there is exactly one use of this value that cannot be dropped. | |
const Use * | getSingleUndroppableUse () const |
LLVM_ABI User * | 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). | |
const User * | getUniqueUndroppableUser () const |
LLVM_ABI bool | hasNUndroppableUses (unsigned N) const |
Return true if there this value. | |
LLVM_ABI bool | hasNUndroppableUsesOrMore (unsigned N) const |
Return true if this value has N uses or more. | |
LLVM_ABI void | dropDroppableUses (llvm::function_ref< bool(const Use *)> ShouldDrop=[](const Use *) { return true;}) |
Remove every uses that can safely be removed. | |
LLVM_ABI void | dropDroppableUsesIn (User &Usr) |
Remove every use of this value in User that can safely be removed. | |
LLVM_ABI bool | isUsedInBasicBlock (const BasicBlock *BB) const |
Check if this value is used in the specified basic block. | |
LLVM_ABI unsigned | getNumUses () const |
This method computes the number of uses of this Value. | |
void | addUse (Use &U) |
This method should only be used by the Use class. | |
unsigned | getValueID () const |
Return an ID for the concrete type of this object. | |
unsigned | getRawSubclassOptionalData () const |
Return the raw optional flags value contained in this value. | |
void | clearSubclassOptionalData () |
Clear the optional flags contained in this value. | |
bool | hasSameSubclassOptionalData (const Value *V) const |
Check the optional flags for equality. | |
bool | hasValueHandle () const |
Return true if there is a value handle associated with this value. | |
bool | isUsedByMetadata () const |
Return true if there is metadata referencing this value. | |
LLVM_ABI bool | isSwiftError () const |
Return true if this value is a swifterror value. | |
LLVM_ABI const Value * | stripPointerCasts () const |
Strip off pointer casts, all-zero GEPs and address space casts. | |
Value * | stripPointerCasts () |
LLVM_ABI const Value * | stripPointerCastsAndAliases () const |
Strip off pointer casts, all-zero GEPs, address space casts, and aliases. | |
Value * | stripPointerCastsAndAliases () |
LLVM_ABI const Value * | stripPointerCastsSameRepresentation () const |
Strip off pointer casts, all-zero GEPs and address space casts but ensures the representation of the result stays the same. | |
Value * | stripPointerCastsSameRepresentation () |
LLVM_ABI const Value * | stripPointerCastsForAliasAnalysis () const |
Strip off pointer casts, all-zero GEPs, single-argument phi nodes and invariant group info. | |
Value * | stripPointerCastsForAliasAnalysis () |
LLVM_ABI const Value * | stripInBoundsConstantOffsets () const |
Strip off pointer casts and all-constant inbounds GEPs. | |
Value * | stripInBoundsConstantOffsets () |
LLVM_ABI const Value * | stripAndAccumulateConstantOffsets (const DataLayout &DL, APInt &Offset, bool AllowNonInbounds, bool AllowInvariantGroup=false, function_ref< bool(Value &Value, APInt &Offset)> ExternalAnalysis=nullptr, bool LookThroughIntToPtr=false) const |
Accumulate the constant offset this value has compared to a base pointer. | |
Value * | stripAndAccumulateConstantOffsets (const DataLayout &DL, APInt &Offset, bool AllowNonInbounds, bool AllowInvariantGroup=false, function_ref< bool(Value &Value, APInt &Offset)> ExternalAnalysis=nullptr, bool LookThroughIntToPtr=false) |
const Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const |
This is a wrapper around stripAndAccumulateConstantOffsets with the in-bounds requirement set to false. | |
Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) |
LLVM_ABI const Value * | stripInBoundsOffsets (function_ref< void(const Value *)> Func=[](const Value *) {}) const |
Strip off pointer casts and inbounds GEPs. | |
Value * | stripInBoundsOffsets (function_ref< void(const Value *)> Func=[](const Value *) {}) |
LLVM_ABI std::optional< int64_t > | getPointerOffsetFrom (const Value *Other, const DataLayout &DL) const |
If this ptr is provably equal to Other plus a constant offset, return that offset in bytes. | |
LLVM_ABI bool | canBeFreed () const |
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. | |
LLVM_ABI uint64_t | getPointerDereferenceableBytes (const DataLayout &DL, bool &CanBeNull, bool &CanBeFreed) const |
Returns the number of bytes known to be dereferenceable for the pointer value. | |
LLVM_ABI Align | getPointerAlignment (const DataLayout &DL) const |
Returns an alignment of the pointer value. | |
LLVM_ABI const Value * | DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const |
Translate PHI node to its predecessor from the given basic block. | |
Value * | DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) |
void | mutateType (Type *Ty) |
Mutate the type of this Value to be of the specified type. | |
template<class Compare > | |
void | sortUseList (Compare Cmp) |
Sort the use-list. | |
LLVM_ABI void | reverseUseList () |
Reverse the use-list. | |
LLVM_ABI void | print (raw_ostream &O, bool IsForDebug=false) const |
Implement operator<< on Value. | |
LLVM_ABI void | print (raw_ostream &O, ModuleSlotTracker &MST, bool IsForDebug=false) const |
LLVM_ABI void | printAsOperand (raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const |
Print the name of this Value out to the specified raw_ostream. | |
LLVM_ABI void | printAsOperand (raw_ostream &O, bool PrintType, ModuleSlotTracker &MST) const |
![]() | |
Instruction * | getPrevNode () |
const Instruction * | getPrevNode () const |
Get the previous node, or nullptr for the list head. | |
Instruction * | getNextNode () |
Get the next node, or nullptr for the list tail. | |
const Instruction * | getNextNode () const |
Get the next node, or nullptr for the list tail. | |
![]() | |
self_iterator | getIterator () |
const_self_iterator | getIterator () const |
reverse_self_iterator | getReverseIterator () |
const_reverse_self_iterator | getReverseIterator () const |
std::enable_if_t< T::is_sentinel_tracking_explicit, bool > | isSentinel () const |
Check whether this is the sentinel node. | |
![]() | |
const ParentTy * | getParent () const |
ParentTy * | getParent () |
void | setParent (ParentTy *Parent) |
Static Public Member Functions | |
static LLVM_ABI const char * | getOpcodeName (unsigned Opcode) |
static bool | isTerminator (unsigned Opcode) |
static bool | isUnaryOp (unsigned Opcode) |
static bool | isBinaryOp (unsigned Opcode) |
static bool | isIntDivRem (unsigned Opcode) |
static bool | isFPDivRem (unsigned Opcode) |
static bool | isShift (unsigned Opcode) |
Determine if the Opcode is one of the shift instructions. | |
static bool | isBitwiseLogicOp (unsigned Opcode) |
Determine if the Opcode is and/or/xor. | |
static bool | isCast (unsigned Opcode) |
Determine if the Opcode is one of the CastInst instructions. | |
static bool | isFuncletPad (unsigned Opcode) |
Determine if the Opcode is one of the FuncletPadInst instructions. | |
static bool | isSpecialTerminator (unsigned Opcode) |
Returns true if the Opcode is a "special" terminator that does more than branch to a successor (e.g. | |
static bool | isAssociative (unsigned Opcode) |
static bool | isCommutative (unsigned Opcode) |
static bool | isIdempotent (unsigned Opcode) |
static bool | isNilpotent (unsigned Opcode) |
static bool | classof (const Value *V) |
Methods for support type inquiry through isa, cast, and dyn_cast: | |
![]() | |
static bool | classof (const Value *V) |
![]() | |
static LLVM_ABI void | dropDroppableUse (Use &U) |
Remove the droppable use U . | |
Public Attributes | |
DbgMarker * | DebugMarker = nullptr |
Optional marker recording the position for debugging information that takes effect immediately before this instruction. | |
Protected Member Functions | |
LLVM_ABI | ~Instruction () |
template<typename BitfieldElement > | |
BitfieldElement::Type | getSubclassData () const |
template<typename BitfieldElement > | |
void | setSubclassData (typename BitfieldElement::Type Value) |
LLVM_ABI | Instruction (Type *Ty, unsigned iType, AllocInfo AllocInfo, InsertPosition InsertBefore=nullptr) |
![]() | |
void * | operator new (size_t Size)=delete |
LLVM_ABI void * | operator new (size_t Size, HungOffOperandsAllocMarker) |
Allocate a User with an operand pointer co-allocated. | |
LLVM_ABI void * | operator new (size_t Size, IntrusiveOperandsAllocMarker allocTrait) |
Allocate a User with the operands co-allocated. | |
LLVM_ABI void * | operator new (size_t Size, IntrusiveOperandsAndDescriptorAllocMarker allocTrait) |
Allocate a User with the operands co-allocated. | |
User (Type *ty, unsigned vty, AllocInfo AllocInfo) | |
LLVM_ABI void | allocHungoffUses (unsigned N, bool IsPhi=false) |
Allocate the array of Uses, followed by a pointer (with bottom bit set) to the User. | |
LLVM_ABI void | growHungoffUses (unsigned N, bool IsPhi=false) |
Grow the number of hung off uses. | |
~User ()=default | |
template<int Idx> | |
Use & | Op () |
template<int Idx> | |
const Use & | Op () const |
![]() | |
LLVM_ABI | Value (Type *Ty, unsigned scid) |
LLVM_ABI | ~Value () |
Value's destructor should be virtual by design, but that would require that Value and all of its subclasses have a vtable that effectively duplicates the information in the value ID. | |
LLVM_ABI void | getAllMetadata (SmallVectorImpl< std::pair< unsigned, MDNode * > > &MDs) const |
Appends all metadata attached to this value to MDs , sorting by KindID. | |
bool | hasMetadata () const |
Return true if this value has any metadata attached to it. | |
LLVM_ABI bool | eraseMetadata (unsigned KindID) |
Erase all metadata attachments with the given kind. | |
LLVM_ABI void | eraseMetadataIf (function_ref< bool(unsigned, MDNode *)> Pred) |
Erase all metadata attachments matching the given predicate. | |
LLVM_ABI void | clearMetadata () |
Erase all metadata attached to this Value. | |
LLVM_ABI MDNode * | getMetadataImpl (unsigned KindID) const |
Get metadata for the given kind, if any. | |
unsigned short | getSubclassDataFromValue () const |
void | setValueSubclassData (unsigned short D) |
MDNode * | getMetadata (unsigned KindID) const |
Get the current metadata attachments for the given kind, if any. | |
LLVM_ABI MDNode * | getMetadata (StringRef Kind) const |
LLVM_ABI void | getMetadata (unsigned KindID, SmallVectorImpl< MDNode * > &MDs) const |
Appends all attachments with the given ID to MDs in insertion order. | |
LLVM_ABI void | getMetadata (StringRef Kind, SmallVectorImpl< MDNode * > &MDs) const |
bool | hasMetadata (unsigned KindID) const |
Return true if this value has the given type of metadata attached. | |
bool | hasMetadata (StringRef Kind) const |
LLVM_ABI void | setMetadata (unsigned KindID, MDNode *Node) |
Set a particular kind of metadata attachment. | |
LLVM_ABI void | setMetadata (StringRef Kind, MDNode *Node) |
LLVM_ABI void | addMetadata (unsigned KindID, MDNode &MD) |
Add a metadata attachment. | |
LLVM_ABI void | addMetadata (StringRef Kind, MDNode &MD) |
![]() | |
ilist_node_with_parent ()=default | |
![]() | |
ilist_node_impl ()=default | |
Friends | |
class | SymbolTableListTraits< Instruction, ilist_iterator_bits< true >, ilist_parent< BasicBlock > > |
class | BasicBlock |
Various leaf nodes. | |
Additional Inherited Members | |
![]() | |
static constexpr unsigned | MaxAlignmentExponent = 32 |
The maximum alignment for instructions. | |
static constexpr uint64_t | MaximumAlignment = 1ULL << MaxAlignmentExponent |
![]() | |
template<int Idx, typename U > | |
static Use & | OpFrom (const U *that) |
![]() | |
unsigned char | SubclassOptionalData: 7 |
Hold subclass data that can be dropped. | |
unsigned | NumUserOperands: NumUserOperandsBits |
unsigned | IsUsedByMD: 1 |
unsigned | HasName: 1 |
unsigned | HasMetadata: 1 |
unsigned | HasHungOffUses: 1 |
unsigned | HasDescriptor: 1 |
Definition at line 66 of file Instruction.h.
|
protected |
Definition at line 145 of file Instruction.h.
|
protected |
Definition at line 153 of file Instruction.h.
|
protected |
Definition at line 150 of file Instruction.h.
using llvm::Instruction::InstListType = SymbolTableList<Instruction, ilist_iterator_bits<true>, ilist_parent<BasicBlock> > |
Definition at line 71 of file Instruction.h.
|
protected |
Definition at line 137 of file Instruction.h.
Definition at line 998 of file Instruction.h.
Definition at line 1012 of file Instruction.h.
Definition at line 1019 of file Instruction.h.
Definition at line 1005 of file Instruction.h.
When checking for operation equivalence (using isSameOperationAs) it is sometimes useful to ignore certain attributes.
Enumerator | |
---|---|
CompareIgnoringAlignment | Check for equivalence ignoring load/store alignment. |
CompareUsingScalarTypes | Check for equivalence treating a type and a vector of that type as equivalent. |
CompareUsingIntersectedAttrs | Check for equivalence with intersected callbase attrs. |
Definition at line 923 of file Instruction.h.
Definition at line 1026 of file Instruction.h.
Definition at line 984 of file Instruction.h.
Definition at line 991 of file Instruction.h.
|
protected |
Definition at line 58 of file Instruction.cpp.
|
delete |
|
protected |
Definition at line 47 of file Instruction.cpp.
void Instruction::addAnnotationMetadata | ( | SmallVector< StringRef > | Annotations | ) |
Adds an !annotation metadata node with an array of Annotations
as a tuple to this instruction.
If this instruction already has !annotation metadata, append the tuple to the existing node.
Definition at line 1741 of file Metadata.cpp.
References llvm::any_of(), llvm::MDBuilder::createString(), llvm::MDTuple::get(), llvm::Value::getContext(), getMetadata(), N, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and setMetadata().
void Instruction::addAnnotationMetadata | ( | StringRef | Annotation | ) |
Adds an !annotation metadata node with Annotation
to this instruction.
If this instruction already has !annotation metadata, append Annotation
to the existing node.
Definition at line 1771 of file Metadata.cpp.
References llvm::MDBuilder::createString(), llvm::MDTuple::get(), llvm::Value::getContext(), getMetadata(), N, Name, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and setMetadata().
void Instruction::adoptDbgRecords | ( | BasicBlock * | BB, |
InstListType::iterator | It, | ||
bool | InsertAtHead | ||
) |
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.
Definition at line 290 of file Instruction.cpp.
Logical 'and' of any supported wrapping, exact, and fast-math flags of V and this instruction.
Definition at line 731 of file Instruction.cpp.
Referenced by llvm::InstCombinerImpl::foldPHIArgBinOpIntoPHI(), llvm::InstCombinerImpl::foldSelectOpOp(), foldShuffleOfUnaryOps(), NegateValue(), and sinkLastInstruction().
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(2*N*I), 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.
Definition at line 897 of file DebugInfo.cpp.
References llvm::DebugLoc::getMergedLocation(), and setDebugLoc().
Referenced by llvm::InstCombinerImpl::PHIArgMergedDebugLoc(), sinkLastInstruction(), llvm::SplitIndirectBrCriticalEdges(), and updateForIncomingValueLocation().
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition at line 977 of file Instruction.h.
Instruction * Instruction::clone | ( | ) | const |
Create a copy of 'this' instruction that is identical in all ways except the following:
Definition at line 1370 of file Instruction.cpp.
References llvm::sandboxir::Value::Ctx, llvm::sandboxir::Tracker::emplaceIfTracking(), llvm::sandboxir::AtomicCmpXchgInst::getFailureOrdering(), llvm::sandboxir::Context::getTracker(), llvm::sandboxir::AtomicCmpXchgInst::setFailureOrdering(), and llvm::sandboxir::Value::Val.
Referenced by buildPartialInvariantUnswitchConditionalBranch(), cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), convertFSqrtDivIntoFMul(), llvm::ehAwareSplitEdge(), llvm::SITargetLowering::emitExpandAtomicAddrSpacePredicate(), expandToSwitch(), findOrCreatePHIInBlock(), llvm::FoldReturnIntoUncondBranch(), llvm::GCNTTIImpl::hoistLaneIntrinsicThroughOperand(), mergeCompatibleInvokesImpl(), replaceGEPIdxWithZero(), SinkCast(), SplitLandingPadPredecessorsImpl(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), and versionCallSiteWithCond().
iterator_range< DbgRecord::self_iterator > Instruction::cloneDebugInfoFrom | ( | const Instruction * | From, |
std::optional< simple_ilist< DbgRecord >::iterator > | FromHere = std::nullopt , |
||
bool | InsertAtHead = false |
||
) |
Clone any debug-info attached to From
onto this instruction.
Used to copy debugging information from one block to another, when copying entire blocks.
From
The instruction to clone debug-info from. from_here
Optional iterator to limit DbgRecords cloned to be a range from from_here to end(). InsertAtHead
Whether the cloned DbgRecords should be placed at the end or the beginning of existing DbgRecords attached to this. Definition at line 261 of file Instruction.cpp.
Referenced by llvm::CloneBasicBlock(), llvm::JumpThreadingPass::cloneInstructions(), cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), and performBranchToCommonDestFolding().
bool Instruction::comesBefore | ( | const Instruction * | Other | ) | const |
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.
Definition at line 342 of file Instruction.cpp.
Referenced by domTreeLevelBefore(), findInsertPos(), llvm::slpvectorizer::BoUpSLP::getReorderingData(), llvm::slpvectorizer::BoUpSLP::getSpillCost(), llvm::InstructionPrecedenceTracking::isPreceededBySpecialInstruction(), llvm::isValidAssumeForContext(), and llvm::ValueDFS_Compare::localComesBefore().
void Instruction::copyFastMathFlags | ( | const Instruction * | I | ) |
Copy I's fast-math flags.
Definition at line 683 of file Instruction.cpp.
References llvm::sandboxir::Instruction::setInsertPos().
void Instruction::copyFastMathFlags | ( | FastMathFlags | FMF | ) |
Convenience function for transferring all fast-math flag values to this instruction, which must be an operator which supports these flags.
See LangRef.html for the meaning of these flags.
Definition at line 633 of file Instruction.cpp.
Referenced by modifyIntrinsicCall(), llvm::InstCombinerImpl::visitFNeg(), and llvm::InstCombinerImpl::visitFPTrunc().
Convenience method to copy supported exact, fast-math, and (optionally) wrapping flags from V to this instruction.
Definition at line 687 of file Instruction.cpp.
Referenced by llvm::CmpInst::CmpInst(), llvm::BinaryOperator::CreateWithCopiedFlags(), llvm::CmpInst::CreateWithCopiedFlags(), llvm::UnaryOperator::CreateWithCopiedFlags(), foldFrexpOfSelect(), llvm::InstCombinerImpl::foldPHIArgBinOpIntoPHI(), llvm::InstCombinerImpl::foldSelectIntoOp(), llvm::InstCombinerImpl::foldSelectOpOp(), foldSelectShuffleWith1Binop(), foldShuffleOfUnaryOps(), llvm::InstCombinerImpl::foldVariableSignZeroExtensionOfVariableHighBitExtract(), llvm::InstCombinerImpl::foldVectorBinop(), and llvm::InstCombinerImpl::visitCallInst().
void Instruction::copyMetadata | ( | const Instruction & | SrcInst, |
ArrayRef< unsigned > | WL = ArrayRef<unsigned>() |
||
) |
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.
Definition at line 1350 of file Instruction.cpp.
Referenced by llvm::breakLoopBackedge(), llvm::ConstantFoldTerminator(), llvm::SelectInst::Create(), llvm::createCallMatchingInvoke(), llvm::IRBuilderBase::CreateCondBr(), doPromotion(), llvm::InstCombinerImpl::foldPHIArgLoadIntoPHI(), hoistConditionalLoadsStores(), instCombineSVELD1(), instCombineSVEST1(), llvm::SITargetLowering::lowerIdempotentRMWIntoFencedLoad(), modifyIntrinsicCall(), scalarizeMaskedLoad(), simplifyAMDGCNMemoryIntrinsicDemanded(), llvm::InstCombinerImpl::SimplifyAnyMemSet(), llvm::InstCombinerImpl::SimplifyAnyMemTransfer(), unpackLoadToAggregate(), llvm::InstCombinerImpl::visitLoadInst(), and llvm::InstCombinerImpl::visitSub().
void Instruction::dropDbgRecords | ( | ) |
Erase any DbgRecords attached to this instruction.
Definition at line 333 of file Instruction.cpp.
Referenced by llvm::removeAllNonTerminatorAndEHPadInstructions(), and splitCallSite().
void Instruction::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.
Definition at line 932 of file DebugInfo.cpp.
References DL, llvm::MDNode::get(), llvm::Value::getContext(), getDebugLoc(), llvm::DebugLoc::getDropped(), getFunction(), llvm::Function::getSubprogram(), II, llvm::IntrinsicInst::mayLowerToFunctionCall(), and setDebugLoc().
Referenced by NegateValue(), unswitchNontrivialInvariants(), and updateLocationAfterHoist().
void Instruction::dropOneDbgRecord | ( | DbgRecord * | I | ) |
Erase a single DbgRecord I
that is attached to this instruction.
Definition at line 338 of file Instruction.cpp.
|
inline |
Drops flags, return attributes and metadata that may generate poison.
Definition at line 573 of file Instruction.h.
Referenced by clearAssumptionsOfUsers().
void Instruction::dropPoisonGeneratingFlags | ( | ) |
Drops flags that may cause this instruction to evaluate to poison despite having non-poison inputs.
Definition at line 434 of file Instruction.cpp.
Referenced by foldSelectShuffleWith1Binop(), optimizeBranch(), llvm::patchReplacementInstruction(), and simplifyAssocCastAssoc().
void Instruction::dropPoisonGeneratingMetadata | ( | ) |
Drops metadata that may generate poison.
Definition at line 510 of file Instruction.cpp.
void Instruction::dropPoisonGeneratingReturnAttributes | ( | ) |
Drops return attributes that may generate poison.
Definition at line 525 of file Instruction.cpp.
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.
Definition at line 555 of file Instruction.cpp.
Referenced by cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), foldOperationIntoSelectOperand(), and llvm::InstCombinerImpl::foldOpIntoPhi().
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.
Definition at line 536 of file Instruction.cpp.
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.
Definition at line 1673 of file Metadata.cpp.
References llvm::SmallSet< T, N, C >::count(), llvm::Value::eraseMetadataIf(), llvm::from_range, llvm::Value::hasMetadata(), and llvm::SmallSet< T, N, C >::insert().
Referenced by generateReproducer(), and llvm::gvn::AvailableValue::MaterializeAdjustedValue().
BasicBlock::iterator Instruction::eraseFromParent | ( | ) |
This method unlinks 'this' from the containing basic block and deletes it.
Definition at line 104 of file Instruction.cpp.
Referenced by llvm::LanaiInstrInfo::analyzeBranch(), buildClonedLoopBlocks(), BuildSubAggregate(), llvm::changeToInvokeAndSplitBasicBlock(), llvm::coro::Shape::cleanCoroutine(), llvm::CloneAndPruneIntoFromInst(), cloneLoopBlocks(), CloneLoopBlocks(), ConnectEpilog(), ConnectProlog(), llvm::ConstantFoldTerminator(), llvm::coro::BaseCloner::create(), llvm::OpenMPIRBuilder::createAtomicCompare(), llvm::OpenMPIRBuilder::createAtomicRead(), llvm::OpenMPIRBuilder::createAtomicWrite(), createCondBranch(), llvm::OpenMPIRBuilder::createCopyinClauseBlocks(), createMemMoveLoopKnownSize(), createMemMoveLoopUnknownSize(), createMemSetLoop(), llvm::OpenMPIRBuilder::createReductions(), llvm::OpenMPIRBuilder::createReductionsGPU(), llvm::OpenMPIRBuilder::createTargetInit(), llvm::OpenMPIRBuilder::createTask(), createTblForTrunc(), llvm::deleteDeadLoop(), despeculateCountZeros(), DoLowering(), doPromotion(), dropTypeTests(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), llvm::OpenMPIRBuilder::emitCancelationCheckImpl(), llvm::LoongArchTargetLowering::emitExpandAtomicRMW(), llvm::OpenMPIRBuilder::emitTargetTask(), llvm::objcarc::BundledRetainClaimRVs::eraseInst(), llvm::objcarc::EraseInstruction(), eraseTerminatorAndDCECond(), llvm::VPIRBasicBlock::execute(), llvm::expandAtomicRMWToCmpXchg(), expandBufferLoadIntrinsic(), expandBufferStoreIntrinsic(), llvm::expandDivision(), llvm::expandDivisionUpTo32Bits(), llvm::expandDivisionUpTo64Bits(), expandFPToI(), expandIntrinsic(), expandIToFP(), llvm::expandRemainder(), llvm::expandRemainderUpTo32Bits(), llvm::expandRemainderUpTo64Bits(), expandToSwitch(), findPHIToPartitionLoops(), foldMemChr(), llvm::FoldReturnIntoUncondBranch(), foldTwoEntryPHINode(), foldURemOfLoopIncrement(), generateUnsignedDivisionCode(), getStrlenWithNull(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), llvm::coro::BaseCloner::handleFinalSuspend(), hostParallelCallback(), injectPendingInvariantConditions(), llvm::InlineFunctionImpl(), insertBoundsCheck(), insertSpills(), insertUniqueBackedgeBlock(), llvm::lowerAtomicCmpXchgInst(), llvm::lowerAtomicRMWInst(), lowerAwaitSuspend(), lowerExpectIntrinsic(), LowerFenceInst(), llvm::SITargetLowering::lowerIdempotentRMWIntoFencedLoad(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::IntrinsicLowering::LowerToByteSwap(), llvm::lowerUnaryVectorIntrinsicAsLoop(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeCleanupPad(), mergeConditionalStoreToAddress(), llvm::InstDeleterIRStrategy::mutate(), optimizeDivRem(), OptimizeEmptyGlobalAtExitDtors(), OptimizeExtractBits(), OptimizeGlobalAddressOfAllocation(), llvm::peelLoop(), processAnd(), processAShr(), llvm::JumpThreadingPass::processBlock(), llvm::JumpThreadingPass::processBranchOnXOR(), processCall(), processCmpIntrinsic(), processMinMaxIntrinsic(), processOverflowIntrinsic(), processSDiv(), processSelect(), processSExt(), processSIToFP(), processSRem(), promoteSingleBlockAlloca(), llvm::OutlinableRegion::reattachCandidate(), llvm::removeAllNonTerminatorAndEHPadInstructions(), llvm::LanaiInstrInfo::removeBranch(), llvm::PHINode::removeIncomingValue(), llvm::PHINode::removeIncomingValueIf(), removeIntrinsicUsers(), removeMarkerCall(), llvm::SCCPSolver::removeNonFeasibleEdges(), RemovePreallocated(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), replaceCalledFunction(), replaceConditionalBranchesOnConstant(), replaceFrameSizeAndAlignment(), replaceIfBranchTargets(), replaceMemCpy(), replaceOperation(), replacePrepare(), llvm::replaceSignedInst(), llvm::rewriteLoopExitValues(), rewritePHIs(), rewriteSingleStoreAlloca(), llvm::SimplifyTypeTestsPass::run(), runImpl(), RunTermFold(), scalarize(), scalarizeMaskedCompressStore(), scalarizeMaskedExpandLoad(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), scalarizeMaskedVectorHistogram(), simplifyOneLoop(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), simplifySuspendPoint(), sinkAndCmp0Expression(), SinkCast(), speculatePHINodeLoads(), llvm::SplitBlockAndInsertSimpleForLoop(), splitCallSite(), llvm::SplitIndirectBrCriticalEdges(), SplitLandingPadPredecessorsImpl(), llvm::splitLoopBound(), stripDebugDeclareImpl(), targetParallelCallback(), tryToMergeLandingPad(), TryToShrinkGlobalToBoolean(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), turnToExplicitForm(), llvm::UnrollAndJamLoop(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), unswitchTrivialSwitch(), llvm::UpgradeARCRuntime(), llvm::UpgradeIntrinsicCall(), versionCallSiteWithCond(), llvm::LoopVersioning::versionLoop(), DataScalarizerVisitor::visitAllocaInst(), DataScalarizerVisitor::visitLoadInst(), llvm::ObjectSizeOffsetEvaluator::visitPHINode(), and workshareLoopTargetCallback().
void Instruction::eraseMetadataIf | ( | function_ref< bool(unsigned, MDNode *)> | Pred | ) |
Erase all metadata that matches the predicate.
Definition at line 1666 of file Metadata.cpp.
References llvm::Value::eraseMetadataIf(), and llvm::DebugLoc::getAsMDNode().
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.
Definition at line 1829 of file Metadata.cpp.
References assert(), and getOpcode().
Referenced by llvm::createCallMatchingInvoke().
AAMDNodes Instruction::getAAMetadata | ( | ) | const |
Returns the AA metadata for this instruction.
Definition at line 1789 of file Metadata.cpp.
References llvm::Value::getContext(), llvm::Value::hasMetadata(), Info, llvm::LLVMContext::pImpl, and llvm::LLVMContextImpl::ValueMetadata.
Referenced by foldLoadsRecursive(), llvm::MemoryLocation::get(), llvm::MemoryLocation::getForDest(), mergeConditionalStoreToAddress(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), llvm::promoteLoopAccessesToScalars(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), speculatePHINodeLoads(), speculateSelectInstLoads(), and unpackLoadToAggregate().
Type * Instruction::getAccessType | ( | ) | const |
Return the type this instruction accesses in memory, if any.
Definition at line 1127 of file Instruction.cpp.
Referenced by getAccessType().
|
inline |
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.
Definition at line 446 of file Instruction.h.
|
inline |
This does the same thing as getAllMetadata, except that it filters out the debug location.
Definition at line 453 of file Instruction.h.
Referenced by llvm::getMetadataToPropagate().
const DataLayout & Instruction::getDataLayout | ( | ) | const |
Get the data layout of the module this instruction belongs to.
Requires the instruction to have a parent module.
Definition at line 86 of file Instruction.cpp.
Referenced by AddAlignmentAssumptions(), llvm::addDiffRuntimeChecks(), llvm::addRuntimeChecks(), llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl(), copyArrayElemsForMemCpy(), llvm::VPlanTransforms::createInterleaveGroups(), llvm::LoongArchTargetLowering::emitExpandAtomicRMW(), llvm::LoongArchTargetLowering::emitMaskedAtomicRMWIntrinsic(), llvm::RISCVTargetLowering::emitMaskedAtomicRMWIntrinsic(), llvm::expandAtomicRMWToCmpXchg(), foldSelectICmpAnd(), llvm::MemoryLocation::get(), llvm::memtag::getAllocaSizeInBytes(), llvm::getAllocSize(), getAtomicOpSize(), llvm::DemandedBits::getDemandedBits(), getMemSetPattern16Value(), llvm::InlineFunctionImpl(), llvm::isDereferenceableAndAlignedInLoop(), llvm::GCNTTIImpl::isInlineAsmSourceOfDivergence(), isLoadInvariantInLoop(), isSafePHIToSpeculate(), llvm::isSafeToSpeculativelyExecuteWithOpcode(), lookThroughCastConst(), NegateValue(), shortenAssignment(), llvm::SITargetLowering::shouldExpandAtomicCmpXchgInIR(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), trackInlinedStores(), and visitIVCast().
|
inline |
Return a range over the DbgRecords attached to this instruction.
Definition at line 105 of file Instruction.h.
References llvm::getDbgRecordRange().
Referenced by getNextNode(), performBranchToCommonDestFolding(), llvm::remapDebugVariable(), and llvm::memtag::StackInfoBuilder::visit().
std::optional< DbgRecord::self_iterator > 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.
Definition at line 275 of file Instruction.cpp.
References B, llvm::sandboxir::Value::Ctx, llvm::sandboxir::Tracker::emplaceIfTracking(), llvm::sandboxir::Context::getTracker(), llvm::sandboxir::Instruction::hasApproxFunc(), llvm::sandboxir::Instruction::setHasApproxFunc(), and llvm::sandboxir::Value::Val.
Return the debug location for this node as a DebugLoc.
Definition at line 513 of file Instruction.h.
Referenced by llvm::LoopVectorizationPlanner::addMinimumIterationCheck(), buildClonedLoopBlocks(), buildPartialInvariantUnswitchConditionalBranch(), llvm::changeToInvokeAndSplitBasicBlock(), checkIfSupported(), llvm::CloneBasicBlock(), llvm::JumpThreadingPass::cloneInstructions(), cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), computeCallStackHash(), ConvertShiftToMul(), llvm::CallBrInst::Create(), llvm::CallInst::Create(), llvm::OpenMPIRBuilder::createTask(), despeculateCountZeros(), diagnoseInvalidFormatString(), dropLocation(), llvm::OpenMPIRBuilder::emitTargetTask(), llvm::extractProbe(), llvm::extractProbeFromDiscriminator(), fixupDebugInfoPostExtraction(), fixupLineNumbers(), foldCondBranchOnValueKnownInPredecessorImpl(), llvm::InstCombinerImpl::foldOpIntoPhi(), llvm::ReplayInlineAdvisor::getAdviceImpl(), llvm::SampleContextTracker::getCalleeContextSamplesFor(), llvm::SelectionDAGBuilder::getCurDebugLoc(), getDebugLocFromPHI(), getOrCreateDebugLoc(), HandleByValArgumentInit(), llvm::hoistAllInstructionsInto(), llvm::InlineFunctionImpl(), llvm::AMDGPU::instrumentAddressImpl(), LowerNegateToMultiply(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), NegateValue(), operandWithNewAddressSpaceOrCreatePoison(), optimizeDivRem(), OptimizeExtractBits(), OptimizeGlobalAddressOfAllocation(), llvm::InstCombinerImpl::PHIArgMergedDebugLoc(), processAShr(), llvm::JumpThreadingPass::processBlock(), processCall(), processSDiv(), processSExt(), processSIToFP(), processSRem(), llvm::SampleContextTracker::promoteMergeContextSamplesTree(), llvm::SCCPSolver::removeNonFeasibleEdges(), llvm::removeUnwindEdge(), replaceConditionalBranchesOnConstant(), llvm::replaceSignedInst(), reportInvalidDirection(), reportNonStaticGEPChain(), llvm::IRTranslator::runOnMachineFunction(), scalarizeMaskedCompressStore(), scalarizeMaskedExpandLoad(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), scalarizeMaskedVectorHistogram(), llvm::FastISel::selectOperator(), llvm::setProbeDistributionFactor(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), sinkAndCmp0Expression(), sinkLastInstruction(), SinkShiftAndTruncate(), splitCallSite(), llvm::SplitIndirectBrCriticalEdges(), llvm::SplitKnownCriticalEdge(), llvm::JumpThreadingPass::threadEdge(), TryToShrinkGlobalToBoolean(), llvm::JumpThreadingPass::unfoldSelectInstr(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), unswitchTrivialSwitch(), updateForIncomingValueLocation(), updateScopeLine(), upgradeDbgIntrinsicToDbgRecord(), and workshareLoopTargetCallback().
FastMathFlags Instruction::getFastMathFlags | ( | ) | const |
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.
Definition at line 678 of file Instruction.cpp.
Referenced by llvm::RecurrenceDescriptor::AddReductionVar(), expandAtan2Intrinsic(), llvm::InstCombinerImpl::foldBinopWithRecurrence(), llvm::InstCombinerImpl::foldFMulReassoc(), foldFNegIntoConstant(), llvm::InstCombinerImpl::foldSelectOpOp(), getISDForVPIntrinsic(), llvm::InstModificationIRStrategy::mutate(), optimizeDoubleFP(), llvm::InstCombinerImpl::SimplifyAssociativeOrCommutative(), and llvm::InstCombinerImpl::visitFPTrunc().
|
inline |
Definition at line 190 of file Instruction.h.
References getFunction().
Return the function this instruction belongs to.
Note: it is undefined behavior to call this on an instruction not currently inserted into a function.
Definition at line 82 of file Instruction.cpp.
References llvm::sandboxir::Tracker::track().
Referenced by llvm::memprof::CallStackTrie::addSingleAllocTypeAttribute(), llvm::VNCoercion::analyzeLoadFromClobberingLoad(), llvm::VNCoercion::analyzeLoadFromClobberingStore(), analyzeLoopUnrollCost(), atomicIgnoresDenormalModeOrFPModeIsFTZ(), llvm::CanInlineCallSite(), canSimplifyNullLoadOrGEP(), canTransformToMemCmp(), diagnoseAmbiguousHandle(), diagnoseHandleNotFound(), diagnoseUndominatedLoad(), dropLocation(), llvm::expandAtomicRMWToCmpXchg(), findCallsAtConstantOffset(), forwardStoredOnceStore(), llvm::InstCombinerImpl::freezeOtherUses(), llvm::ReplayInlineAdvisor::getAdviceImpl(), getInstrDenormalMode(), llvm::VNCoercion::getMemInstValueForLoad(), llvm::coro::Shape::getRetconResultTypes(), HandleByValArgument(), insertLifetimeMarkersSurroundingCall(), insertSpills(), llvm::InstrumentationIRBuilder::InstrumentationIRBuilder(), isAtomicRMWLegalXChgTy(), isKnownNonEqualFromContext(), isKnownNonNullFromDominatingCondition(), isKnownNonZeroFromAssume(), llvm::isKnownToBeAPowerOfTwo(), IsOperandAMemoryOperand(), llvm::AA::isPotentiallyReachable(), isPotentiallyReachable(), llvm::AA::isValidAtPosition(), llvm::lowerAtomicRMWInst(), llvm::lowerObjectSizeCall(), mergeDIAssignID(), llvm::LoopInfo::movementPreservesLCSSAForm(), NegateValue(), optimizeDoubleFP(), llvm::AlignmentFromAssumptionsPass::processAssumption(), promoteArguments(), llvm::promoteCallWithIfThenElse(), removeTailCallAttribute(), reportInvalidDirection(), reportNonStaticGEPChain(), llvm::CoroIdInst::setCoroutineSelf(), llvm::SITargetLowering::shouldExpandAtomicRMWInIR(), llvm::UnreachableInst::shouldLowerToTrap(), simplifyFCmpInst(), simplifyInstructionWithOperands(), llvm::OutlinableRegion::splitCandidate(), suppressSpeculativeLoadForSanitizers(), tryToOptimizeStoreOfAllocationToGlobal(), llvm::InstCombinerImpl::visitCallInst(), llvm::InstCombinerImpl::visitLoadInst(), llvm::InstCombinerImpl::visitReturnInst(), llvm::InstCombinerImpl::visitSExt(), llvm::InstCombinerImpl::visitTrunc(), and llvm::InstCombinerImpl::visitZExt().
std::optional< BasicBlock::iterator > Instruction::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.
Definition at line 352 of file Instruction.cpp.
Get the metadata of given kind attached to this Instruction.
If the metadata is not found then return null.
Definition at line 437 of file Instruction.h.
Get the metadata of given kind attached to this Instruction.
If the metadata is not found then return null.
Definition at line 428 of file Instruction.h.
References llvm::DebugLoc::getAsMDNode().
Referenced by AddAliasScopeMetadata(), addAnnotationMetadata(), addBasicBlockMetadata(), llvm::MachineFunction::CallSiteInfo::CallSiteInfo(), llvm::changeToInvokeAndSplitBasicBlock(), combineMetadata(), convertMetadataToAssumes(), llvm::DbgVariableRecord::createLinkedDVRAssign(), llvm::IRBuilderBase::CreateSelectFMF(), llvm::diagnoseDontCall(), emitDbgAssign(), expandToSwitch(), foldTwoEntryPHINode(), getAllocaName(), getBranchWeights(), llvm::at::getDVRAssignmentMarkers(), getFromRangeMetadata(), llvm::Loop::getLoopID(), llvm::MDNode::getMergedProfMetadata(), llvm::ScopedNoAliasAAResult::getModRefInfo(), llvm::TypeBasedAAResult::getModRefInfo(), llvm::LoopVersioning::getNoAliasMetadataFor(), hasOnlyUniformBranches(), llvm::DIBuilder::insertDbgAssign(), insertUniqueBackedgeBlock(), llvm::intersectAccessGroups(), isInvariantLoad(), isProfitableToSpeculate(), llvm::SPIRVCallLowering::lowerCall(), llvm::CallLowering::lowerCall(), llvm::FastISel::lowerCallTo(), llvm::makeGuardControlFlowExplicit(), llvm::mayHaveValueProfileOfKind(), mergeDIAssignID(), migrateDebugInfo(), llvm::LoopStructure::parseLoopStructure(), performBranchToCommonDestFolding(), PropagateCallSiteMetadata(), propagateMemProfHelper(), propagateMemProfMetadata(), llvm::propagateMetadata(), shouldFoldCondBranchesToCommonDestination(), SimplifyCondBranchToCondBranch(), SplitBlockPredecessorsImpl(), llvm::SplitKnownCriticalEdge(), translateBranchMetadata(), turnGuardIntoBranch(), and unswitchNontrivialInvariants().
|
inline |
Definition at line 180 of file Instruction.h.
Return the module owning the function this instruction belongs to or nullptr it the function does not have a module.
Note: this is undefined behavior if the instruction does not have a parent, or the parent basic block does not have a parent function.
Definition at line 78 of file Instruction.cpp.
Referenced by addAssumeNonNull(), addMappingsFromTLI(), addVariantDeclaration(), llvm::buildAssumeFromKnowledge(), cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), llvm::OpenMPIRBuilder::createAtomicRead(), llvm::OpenMPIRBuilder::createAtomicWrite(), createCoroSave(), CreateGCRelocates(), llvm::LoongArchTargetLowering::emitMaskedAtomicRMWIntrinsic(), llvm::RISCVTargetLowering::emitMaskedAtomicRMWIntrinsic(), llvm::AMDGPULibCalls::fold(), foldShuffleOfUnaryOps(), llvm::InstCombinerImpl::foldVectorBinop(), getMemSetPattern16Value(), llvm::LazyValueInfo::getPredicateAt(), llvm::InstrProfIncrementInst::getStep(), llvm::VFABI::getVectorVariantNames(), insertSpills(), llvm::TargetLibraryInfoImpl::isCallingConvCCompatible(), lowerFunnelShifts(), llvm::IntrinsicLowering::LowerToByteSwap(), migrateDebugInfo(), llvm::LibCallSimplifier::optimizeCall(), promoteSingleBlockAlloca(), ReplaceCallWith(), rewriteSingleStoreAlloca(), llvm::LoopVectorizationCostModel::setVectorizedCallDecision(), llvm::VFABI::setVectorVariantNames(), tryToReplaceWithGEPBuiltin(), upgradeX86IntrinsicCall(), llvm::AMDGPULibCalls::useNative(), llvm::InstCombinerImpl::visitBitCast(), llvm::InstCombinerImpl::visitCallInst(), and llvm::InstCombinerImpl::visitFPTrunc().
unsigned Instruction::getNumSuccessors | ( | ) | const |
Return the number of successors that this instruction has.
The instruction must be a terminator.
Definition at line 1280 of file Instruction.cpp.
Referenced by llvm::BranchProbabilityInfo::calculate(), llvm::FunctionComparator::compare(), llvm::deleteDeadLoop(), getBestDestForJumpOnUndef(), getBranchHint(), llvm::DOTGraphTraits< DOTFuncInfo * >::getEdgeAttributes(), getInstrBB(), llvm::MustBeExecutedContextExplorer::getMustBeExecutedNextInstruction(), llvm::RegionTraits< Function >::getNumSuccessors(), llvm::isCriticalEdge(), llvm::SparseSolver< LatticeKey, LatticeVal, KeyInfo >::isEdgeFeasible(), isSafePHIToSpeculate(), llvm::JumpThreadingPass::maybeMergeBasicBlockIntoOnlyPred(), llvm::JumpThreadingPass::processBlock(), llvm::JumpThreadingPass::processThreadableEdges(), replaceConstantExprOp(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), skipPGOUse(), llvm::SplitAllCriticalEdges(), llvm::SplitCriticalEdge(), llvm::SplitEdge(), llvm::SplitKnownCriticalEdge(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), and llvm::JumpThreadingPass::tryToUnfoldSelectInCurrBB().
|
inline |
Returns a member of one of the enums like Instruction::Add.
Definition at line 312 of file Instruction.h.
Referenced by allSameOpcode(), llvm::LanaiInstrInfo::analyzeBranch(), analyzeCostOfVecReduction(), canEvaluateShiftedShift(), canPHITrans(), llvm::SCEVExpander::canReuseFlagsFromOriginalIVInc(), checkIfSafeAddSequence(), collectOffsetOp(), llvm::VPInterleaveRecipe::computeCost(), llvm::VPReplicateRecipe::computeCost(), llvm::InstCombinerImpl::convertOrOfShiftsToFunnelShift(), llvm::CallBase::Create(), detectPopcountIdiom(), detectShiftUntilLessThanIdiom(), detectShiftUntilZeroIdiom(), doesInTreeUserNeedToExtract(), expandFPToI(), expandIToFP(), extractProfTotalWeight(), llvm::RISCVTargetLowering::fallBackToDAGISel(), findDemandedEltsBySingleUser(), findIBRPredecessor(), foldFPtoI(), llvm::InstCombinerImpl::foldICmpInstWithConstantNotInt(), llvm::InstCombinerImpl::foldICmpUsingBoolRange(), llvm::InstCombinerImpl::foldMultiplicationOverflowCheck(), llvm::InstCombinerImpl::foldPHIArgBinOpIntoPHI(), llvm::InstCombinerImpl::foldSelectOpOp(), foldShiftIntoShiftInAnotherHandOfAndInICmp(), foldSignedTruncationCheck(), llvm::InstCombinerImpl::foldVariableSignZeroExtensionOfVariableHighBitExtract(), getExtractIndex(), getFromRangeMetadata(), getHashValueImpl(), llvm::SCEVExpander::getIVIncOperand(), getLoopPhiForCounter(), getMainAltOpsNoStateVL(), llvm::CallBase::getNumSubclassExtraOperands(), llvm::CallBase::getNumSubclassExtraOperandsDynamic(), llvm::UnaryOperator::getOpcode(), llvm::BinaryOperator::getOpcode(), llvm::CastInst::getOpcode(), llvm::CmpInst::getOpcode(), llvm::SelectInst::getOpcode(), llvm::MemoryLocation::getOrNone(), llvm::LoopVectorizationCostModel::getReductionPatternCost(), getSameOpcode(), hashCallInst(), llvm::InlineFunctionImpl(), isEqualImpl(), llvm::AArch64TTIImpl::isExtPartOfAvgExpr(), llvm::SystemZTTIImpl::isFoldableLoad(), isHighCostExpansion(), isMatchingStore(), llvm::AArch64TTIImpl::isProfitableToSinkOperands(), llvm::ARMTTIImpl::isProfitableToSinkOperands(), isPromotedInstructionLegal(), isReturnNonNull(), llvm::isSafeToSpeculativelyExecute(), llvm::isSafeToSpeculativelyExecuteWithOpcode(), matchExpandedRem(), llvm::InstModificationIRStrategy::mutate(), needsFP(), NegateValue(), performBlockTailMerging(), llvm::BasicTTIImplBase< T >::preferToKeepConstantsAttached(), llvm::JumpThreadingPass::processBlock(), promoteAllocaUserToVector(), llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(), llvm::refineInstruction(), llvm::LanaiInstrInfo::removeBranch(), llvm::replaceSignedInst(), llvm::InstCombinerImpl::simplifyShrShlDemandedBits(), SinkShiftAndTruncate(), llvm::InstCombinerImpl::SliceUpIllegalIntegerPHI(), llvm::VPRecipeBuilder::tryToCreateWidenRecipe(), llvm::InstCombinerImpl::visitCallInst(), llvm::InstCombinerImpl::visitFCmpInst(), and llvm::InstCombinerImpl::visitICmpInst().
Definition at line 314 of file Instruction.h.
References getOpcode(), and getOpcodeName().
Referenced by checkInstructions(), llvm::LoopVectorizationPlanner::emitInvalidCostRemarks(), llvm::VPWidenRecipe::execute(), llvm::ConstantExpr::getOpcodeName(), getOpcodeName(), llvm::VPInstruction::print(), llvm::VPInstructionWithType::print(), llvm::VPWidenRecipe::print(), llvm::VPWidenCastRecipe::print(), llvm::VPReductionRecipe::print(), llvm::VPPartialReductionRecipe::print(), llvm::VPReductionEVLRecipe::print(), llvm::VPReplicateRecipe::print(), llvm::VPExpressionRecipe::print(), PrintOps(), and remarkFlatAddrspaceAccess().
Definition at line 776 of file Instruction.cpp.
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.
Definition at line 1252 of file Instruction.cpp.
Referenced by restoreIPandDebugLoc().
|
inlineprotected |
Definition at line 1053 of file Instruction.h.
BasicBlock * Instruction::getSuccessor | ( | unsigned | Idx | ) | const |
Return the specified successor. This instruction must be a terminator.
Definition at line 1292 of file Instruction.cpp.
Referenced by llvm::FunctionComparator::compare(), llvm::OpenMPIRBuilder::createSection(), findLoopComponents(), getBestDestForJumpOnUndef(), getBranchHint(), llvm::DOTGraphTraits< DOTFuncInfo * >::getEdgeAttributes(), llvm::MustBeExecutedContextExplorer::getMustBeExecutedNextInstruction(), getOnlyLiveSuccessor(), llvm::isCriticalEdge(), llvm::SparseSolver< LatticeKey, LatticeVal, KeyInfo >::isEdgeFeasible(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), optimizeSQRT(), llvm::JumpThreadingPass::processBlock(), scalarizeMaskedCompressStore(), scalarizeMaskedExpandLoad(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), scalarizeMaskedVectorHistogram(), llvm::SplitCriticalEdge(), llvm::SplitKnownCriticalEdge(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), and llvm::UnrollAndJamLoop().
void Instruction::handleMarkerRemoval | ( | ) |
Handle the debug-info implications of this instruction being removed.
Any attached DbgRecords need to "fall" down onto the next instruction.
Definition at line 97 of file Instruction.cpp.
bool Instruction::hasAllowContract | ( | ) | const |
Determine whether the allow-contract flag is set.
Definition at line 668 of file Instruction.cpp.
Referenced by llvm::GCNTTIImpl::getArithmeticInstrCost(), and llvm::InstModificationIRStrategy::mutate().
bool Instruction::hasAllowReassoc | ( | ) | const |
Determine whether the allow-reassociation flag is set.
Definition at line 643 of file Instruction.cpp.
References llvm::sandboxir::Value::Ctx, llvm::sandboxir::Tracker::emplaceIfTracking(), llvm::sandboxir::Context::getTracker(), llvm::sandboxir::LandingPadInst::isCleanup(), llvm::sandboxir::LandingPadInst::setCleanup(), and llvm::sandboxir::Value::Val.
Referenced by llvm::InductionDescriptor::getExactFPMathInst(), isFSqrtDivToFMulLegal(), and llvm::InstModificationIRStrategy::mutate().
bool Instruction::hasAllowReciprocal | ( | ) | const |
Determine whether the allow-reciprocal flag is set.
Definition at line 663 of file Instruction.cpp.
Referenced by llvm::InstModificationIRStrategy::mutate().
bool Instruction::hasApproxFunc | ( | ) | const |
Determine whether the approximate-math-functions flag is set.
Definition at line 673 of file Instruction.cpp.
Referenced by llvm::GCNTTIImpl::getArithmeticInstrCost(), and llvm::InstModificationIRStrategy::mutate().
bool Instruction::hasAtomicLoad | ( | ) | const |
Return true if this atomic instruction loads from memory.
Definition at line 1073 of file Instruction.cpp.
Referenced by llvm::PPCTargetLowering::emitTrailingFence().
bool Instruction::hasAtomicStore | ( | ) | const |
Return true if this atomic instruction stores to memory.
Definition at line 1085 of file Instruction.cpp.
Referenced by llvm::TargetLoweringBase::emitLeadingFence(), llvm::ARMTargetLowering::emitLeadingFence(), and llvm::VETargetLowering::emitLeadingFence().
bool Instruction::hasDbgRecords | ( | ) | const |
Returns true if any DbgRecords are attached to this instruction.
Definition at line 288 of file Instruction.cpp.
Referenced by getNextNode().
|
inline |
Return true if this instruction has any metadata attached to it.
Definition at line 406 of file Instruction.h.
Referenced by atomicIgnoresDenormalModeOrFPModeIsFTZ(), convertMetadataToAssumes(), doPromotion(), getAllocaName(), llvm::MemoryDependenceResults::getInvariantGroupPointerDependency(), llvm::TargetLoweringBase::getLoadMemOperandFlags(), llvm::SITargetLowering::getTgtMemIntrinsic(), llvm::TargetLoweringBase::getVPIntrinsicMemOperandFlags(), globalMemoryFPAtomicIsLegal(), insertNewDbgInst(), IsAcceptableTarget(), llvm::SPIRVCallLowering::lowerCall(), llvm::gvn::AvailableValue::MaterializeAdjustedValue(), setMetadata(), llvm::SITargetLowering::shouldExpandAtomicRMWInIR(), and updateMemprofMetadata().
Return true if this instruction has the given type of metadata attached.
Definition at line 422 of file Instruction.h.
Return true if this instruction has the given type of metadata attached.
Definition at line 417 of file Instruction.h.
|
inline |
Return true if this instruction has metadata attached to it other than a debug location.
Definition at line 414 of file Instruction.h.
bool Instruction::hasNoInfs | ( | ) | const |
Determine whether the no-infs flag is set.
Definition at line 653 of file Instruction.cpp.
Referenced by foldFCmpFSubIntoFCmp(), foldFCmpReciprocalAndZero(), llvm::InstCombinerImpl::foldSelectIntoOp(), isFSqrtDivToFMulLegal(), and llvm::InstModificationIRStrategy::mutate().
bool Instruction::hasNoNaNs | ( | ) | const |
Determine whether the no-NaNs flag is set.
Definition at line 648 of file Instruction.cpp.
Referenced by foldFCmpFSubIntoFCmp(), llvm::InstCombinerImpl::foldSelectIntoOp(), llvm::CmpInst::isEquivalence(), isFSqrtDivToFMulLegal(), llvm::matchDecomposedSelectPattern(), and llvm::InstModificationIRStrategy::mutate().
bool Instruction::hasNonDebugLocLoopMetadata | ( | ) | const |
Definition at line 487 of file Instruction.cpp.
bool Instruction::hasNonNeg | ( | ) | const |
Determine whether the the nneg flag is set.
Definition at line 425 of file Instruction.cpp.
Referenced by llvm::refineInstruction(), llvm::InstCombinerImpl::visitUIToFP(), and llvm::InstCombinerImpl::visitZExt().
bool Instruction::hasNoSignedWrap | ( | ) | const |
Determine whether the no signed wrap flag is set.
Definition at line 418 of file Instruction.cpp.
Referenced by buildNew(), checkNoWrapFlags(), llvm::InstCombinerImpl::commonIDivTransforms(), detectShiftUntilZeroIdiom(), llvm::InstCombinerImpl::foldICmpBinOp(), llvm::InstCombinerImpl::foldICmpShlConstant(), foldMulShl1(), llvm::InstCombinerImpl::FoldShiftByConstant(), isNonZeroRecurrence(), llvm::InstModificationIRStrategy::mutate(), processBinOp(), llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(), llvm::refineInstruction(), setLimitsForBinOp(), llvm::InstCombinerImpl::simplifyShrShlDemandedBits(), and llvm::InstCombinerImpl::visitLShr().
bool Instruction::hasNoSignedZeros | ( | ) | const |
Determine whether the no-signed-zeros flag is set.
Definition at line 658 of file Instruction.cpp.
Referenced by foldSelectBinOpIdentity(), llvm::InstCombinerImpl::foldSelectIntoOp(), isFSqrtDivToFMulLegal(), llvm::InstModificationIRStrategy::mutate(), and simplifySelectWithFCmp().
bool Instruction::hasNoUnsignedWrap | ( | ) | const |
Determine whether the no unsigned wrap flag is set.
Definition at line 411 of file Instruction.cpp.
Referenced by allowsPreservingNUW(), buildNew(), checkNoWrapFlags(), detectShiftUntilZeroIdiom(), llvm::InstCombinerImpl::foldICmpBinOp(), llvm::InstCombinerImpl::foldICmpShlConstant(), foldMulShl1(), llvm::InstCombinerImpl::FoldShiftByConstant(), isNonZeroRecurrence(), llvm::InstModificationIRStrategy::mutate(), processBinOp(), llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(), llvm::refineInstruction(), llvm::InstCombinerImpl::simplifyShrShlDemandedBits(), llvm::InstCombinerImpl::visitLShr(), and llvm::InstCombinerImpl::visitSub().
|
inline |
Return true if this instruction has poison-generating flags, return attributes or metadata.
Definition at line 566 of file Instruction.h.
bool Instruction::hasPoisonGeneratingFlags | ( | ) | const |
Return true if this operator has flags which may cause this instruction to evaluate to poison despite having non-poison inputs.
Definition at line 430 of file Instruction.cpp.
References llvm::sandboxir::Context::createStoreInst(), llvm::sandboxir::Value::Ctx, Ptr, and llvm::sandboxir::Instruction::setInsertPos().
Referenced by canFoldTermCondOfLoop().
bool Instruction::hasPoisonGeneratingMetadata | ( | ) | const |
Return true if this instruction has poison-generating metadata.
Definition at line 482 of file Instruction.cpp.
bool Instruction::hasPoisonGeneratingReturnAttributes | ( | ) | const |
Return true if this instruction has poison-generating attribute.
Definition at line 515 of file Instruction.cpp.
bool Instruction::hasSameSpecialState | ( | const Instruction * | I2, |
bool | IgnoreAlignment = false , |
||
bool | IntersectAttrs = false |
||
) | const |
This function determines if the speficied instruction has the same "special" characteristics as the current one.
This must be kept in sync with FunctionComparator::cmpOperations in lib/Transforms/IPO/MergeFunctions.cpp.
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).
Definition at line 864 of file Instruction.cpp.
bool Instruction::hasUBImplyingAttrs | ( | ) | const |
Return true if this instruction has UB-implying attributes that can cause immediate undefined behavior.
Definition at line 570 of file Instruction.cpp.
void Instruction::insertAfter | ( | InstListType::iterator | InsertPos | ) |
Insert an unlinked instruction into a basic block immediately after the specified position.
Definition at line 127 of file Instruction.cpp.
void Instruction::insertAfter | ( | Instruction * | InsertPos | ) |
Insert an unlinked instruction into a basic block immediately after the specified instruction.
Definition at line 121 of file Instruction.cpp.
Referenced by addAssumeNonNull(), llvm::OpenMPIRBuilder::createParallel(), optimizeDivRem(), and rewritePHIsForCleanupPad().
void Instruction::insertBefore | ( | BasicBlock & | BB, |
InstListType::iterator | InsertPos | ||
) |
Definition at line 142 of file Instruction.cpp.
References llvm::ilist_node_impl< OptionsT >::getIterator().
void Instruction::insertBefore | ( | InstListType::iterator | InsertPos | ) |
Insert an unlinked instruction into a basic block immediately before the specified position.
Insert an unlinked instruction into a basic block immediately before the specified instruction.
Definition at line 115 of file Instruction.cpp.
Referenced by llvm::changeToCall(), llvm::CloneBasicBlock(), cloneInstructionInExitBlock(), CloneLoopBlocks(), ConnectEpilog(), ConnectProlog(), llvm::DbgVariableRecord::createDebugIntrinsic(), llvm::createPHIsForSplitLoopExit(), llvm::expandUser(), findBasePointer(), findOrCreatePHIInBlock(), formLCSSAForInstructionsImpl(), generateReproducer(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleByValArgument(), llvm::BPFCoreSharedInfo::insertPassThrough(), insertTrivialPHIs(), moveLCSSAPhis(), movePHIValuesToInsertedBlock(), OptimizeExtractBits(), rematerializeChain(), replaceConstantExprOp(), rewriteMaterializableInstructions(), rewritePHIs(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), SinkCast(), sinkCmpExpression(), sinkInstruction(), SinkShiftAndTruncate(), splitCallSite(), llvm::SplitIndirectBrCriticalEdges(), llvm::JumpThreadingPass::threadGuard(), tryToReplaceWithGEPBuiltin(), llvm::UnrollRuntimeLoopRemainder(), versionCallSiteWithCond(), DataScalarizerVisitor::visitLoadInst(), and DataScalarizerVisitor::visitStoreInst().
BasicBlock::iterator Instruction::insertInto | ( | BasicBlock * | ParentBB, |
InstListType::iterator | It | ||
) |
Inserts an unlinked instruction into ParentBB
at position It
and returns the iterator of the inserted instruction.
Definition at line 133 of file Instruction.cpp.
Referenced by buildPartialInvariantUnswitchConditionalBranch(), cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), createWrapper(), llvm::SITargetLowering::emitExpandAtomicAddrSpacePredicate(), llvm::FoldReturnIntoUncondBranch(), mergeCompatibleInvokesImpl(), performBlockTailMerging(), replaceArgumentUses(), SplitLandingPadPredecessorsImpl(), llvm::JumpThreadingPass::unfoldSelectInstr(), unswitchNontrivialInvariants(), and unswitchTrivialBranch().
|
inline |
Return true if this is an arithmetic shift right.
Definition at line 361 of file Instruction.h.
References getOpcode().
Referenced by llvm::InstCombinerImpl::foldICmpAndShift().
bool Instruction::isAssociative | ( | ) | const |
Return true if the instruction is associative:
Associative operators satisfy: x op (y op z) === (x op y) op z
In LLVM, the Add, Mul, And, Or, and Xor operators are associative.
Definition at line 1256 of file Instruction.cpp.
Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::InstCombinerImpl::foldBinopWithRecurrence(), llvm::InstCombinerImpl::foldVectorBinop(), and simplifyAssociativeBinOp().
Definition at line 752 of file Instruction.h.
bool Instruction::isAtomic | ( | ) | const |
Return true if this instruction has an AtomicOrdering of unordered or higher.
Definition at line 1058 of file Instruction.cpp.
Referenced by llvm::InstCombinerImpl::combineLoadToNewType(), llvm::InstCombinerImpl::foldPHIArgLoadIntoPHI(), llvm::LoadInst::isSimple(), llvm::StoreInst::isSimple(), and llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad().
|
inline |
Definition at line 317 of file Instruction.h.
References getOpcode(), and isBinaryOp().
Referenced by llvm::ConstantRange::binaryOp(), canCreateUndefOrPoison(), llvm::BinaryConstantExpr::classof(), llvm::VPInstruction::computeCost(), llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldBinaryOpOperands(), llvm::ConstantFoldFPInstOperands(), llvm::ConstantExprKeyType::create(), llvm::IRBuilderBase::CreateNAryOp(), llvm::ConstantExpr::get(), llvm::ConstantExpr::getBinOpIdentity(), llvm::slpvectorizer::BoUpSLP::getReorderingData(), isBinaryOp(), isConstExprSupported(), llvm::slpvectorizer::BoUpSLP::isProfitableToReorder(), llvm::isSafeToSpeculativelyExecuteWithOpcode(), llvm::vputils::isSingleScalar(), llvm::ConstantRange::makeGuaranteedNoWrapRegion(), llvm::VPInstruction::onlyFirstLaneUsed(), llvm::VPInstruction::onlyFirstPartUsed(), llvm::VPInstruction::opcodeMayReadOrWriteFromMemory(), llvm::ConstantRange::overflowingBinaryOp(), simplifySVEIntrinsic(), simplifySVEIntrinsicBinOp(), and tryToFoldLiveIns().
Definition at line 338 of file Instruction.h.
|
inline |
Return true if this is and/or/xor.
Definition at line 371 of file Instruction.h.
References getOpcode().
Referenced by llvm::InstCombinerImpl::foldBinOpShiftWithShift(), getBinOpsForFactorization(), llvm::PatternMatch::is_bitwiselogic_op::isOpType(), and rightDistributesOverLeft().
Determine if the Opcode is and/or/xor.
Definition at line 366 of file Instruction.h.
References llvm::Xor.
Referenced by foldBitCastBitwiseLogic(), and simplifyAssocCastAssoc().
|
inline |
Definition at line 321 of file Instruction.h.
References getOpcode(), and isCast().
Referenced by llvm::CastConstantExpr::classof(), llvm::ConstantFoldCastOperand(), llvm::ConstantExprKeyType::create(), llvm::InstCombinerImpl::foldSelectOpOp(), llvm::ConstantExpr::getCast(), llvm::ConstantExpr::isCast(), isCast(), isConstExprSupported(), llvm::VPRecipeBase::isScalarCast(), llvm::vputils::isSingleScalar(), llvm::VPCastIntrinsic::isVPCast(), llvm::VPInstruction::onlyFirstLaneUsed(), llvm::VPInstruction::opcodeMayReadOrWriteFromMemory(), llvm::VPInstructionWithType::print(), and tryToFoldLiveIns().
Determine if the Opcode is one of the CastInst instructions.
Definition at line 376 of file Instruction.h.
bool Instruction::isCommutative | ( | ) | const |
Return true if the instruction is commutative:
Commutative operators satisfy: (x op y) === (y op x)
In LLVM, these are the commutative operators, plus SetEQ and SetNE, when applied to any type.
Definition at line 1273 of file Instruction.cpp.
Referenced by llvm::RecurrenceDescriptor::AddReductionVar(), areCommutative(), llvm::ConstantFoldBinaryInstruction(), expandBinOp(), llvm::InstCombinerImpl::foldBinopWithRecurrence(), foldOrCommuteConstant(), foldSelectBinOpIdentity(), llvm::InstCombinerImpl::foldSelectOpOp(), llvm::InstCombinerImpl::foldVectorBinop(), llvm::ConstantExpr::getBinOpIdentity(), llvm::RISCVTTIImpl::getIntImmCostInst(), llvm::OverflowingBinaryOperator::isCommutative(), matchStridedStart(), rightDistributesOverLeft(), simplifyAssociativeBinOp(), llvm::InstCombinerImpl::SimplifyDemandedVectorElts(), simplifySVEIntrinsicBinOp(), llvm::BinaryOperator::swapOperands(), tryFactorization(), and llvm::InstCombinerImpl::visitShl().
Definition at line 765 of file Instruction.h.
References llvm::FAdd, llvm::FMul, Mul, and llvm::Xor.
bool Instruction::isDebugOrPseudoInst | ( | ) | const |
Return true if the instruction is a DbgInfoIntrinsic or PseudoProbeInst.
Definition at line 1248 of file Instruction.cpp.
Referenced by llvm::findAvailablePtrLoadStore(), findInsertPos(), and ProcessBlock().
|
inline |
Return true if the instruction is a variety of EH-block.
Definition at line 879 of file Instruction.h.
References getOpcode().
Referenced by llvm::ehAwareSplitEdge(), getEHPadFromPredecessor(), isSafeToMove(), llvm::removeAllNonTerminatorAndEHPadInstructions(), and SinkCast().
bool Instruction::isExact | ( | ) | const |
Determine whether the exact flag is set.
Definition at line 584 of file Instruction.cpp.
Referenced by buildNew(), llvm::InstCombinerImpl::foldICmpBinOp(), llvm::InstCombinerImpl::foldICmpBinOpEqualityWithConstant(), llvm::InstCombinerImpl::foldICmpDivConstant(), llvm::InstCombinerImpl::foldICmpShrConstant(), llvm::InstCombinerImpl::FoldShiftByConstant(), isNonZeroRecurrence(), llvm::InstModificationIRStrategy::mutate(), processAShr(), processSDiv(), llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(), llvm::replaceSignedInst(), and llvm::InstCombinerImpl::visitMul().
bool Instruction::isFast | ( | ) | const |
Determine whether all fast-math-flags are set.
Definition at line 638 of file Instruction.cpp.
Referenced by llvm::LibCallSimplifier::optimizeCall().
|
inline |
Return true if this instruction behaves like a memory fence: it can load or store to memory location without being given a memory location.
Definition at line 838 of file Instruction.h.
References getOpcode().
|
inline |
Definition at line 319 of file Instruction.h.
References getOpcode(), and isFPDivRem().
Referenced by isFPDivRem().
Definition at line 346 of file Instruction.h.
|
inline |
Definition at line 322 of file Instruction.h.
References getOpcode(), and isFuncletPad().
Referenced by isFuncletPad().
Determine if the Opcode is one of the FuncletPadInst instructions.
Definition at line 381 of file Instruction.h.
|
inline |
Return true if the instruction is idempotent:
Idempotent operators satisfy: x op x === x
In LLVM, the And and Or operators are idempotent.
Definition at line 782 of file Instruction.h.
References getOpcode(), and isIdempotent().
Referenced by isIdempotent().
Definition at line 783 of file Instruction.h.
bool Instruction::isIdenticalTo | ( | const Instruction * | I | ) | const |
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.
Definition at line 942 of file Instruction.cpp.
References llvm::CallingConv::C, llvm::sandboxir::CmpInst::create(), llvm::sandboxir::Value::Ctx, Name, P, and S1.
Referenced by tryToMergeLandingPad(), and llvm::InstCombinerImpl::visitFenceInst().
bool Instruction::isIdenticalToWhenDefined | ( | const Instruction * | I, |
bool | IntersectAttrs = false |
||
) | const |
This is like isIdenticalTo, except that it ignores the SubclassOptionalData flags, which may specify conditions under which the instruction's result is undefined.
Definition at line 947 of file Instruction.cpp.
Referenced by EliminateDuplicatePHINodesNaiveImpl(), and isEqualImpl().
|
inline |
Definition at line 318 of file Instruction.h.
References getOpcode(), and isIntDivRem().
Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::InstCombinerImpl::foldSelectShuffle(), foldSelectShuffleWith1Binop(), llvm::InstCombinerImpl::foldVectorBinop(), generateKeySubkey(), isIntDivRem(), and llvm::InstCombinerImpl::SimplifyDemandedVectorElts().
Definition at line 342 of file Instruction.h.
bool Instruction::isLaunderOrStripInvariantGroup | ( | ) | const |
Return true if the instruction is a llvm.launder.invariant.group or llvm.strip.invariant.group.
Definition at line 1239 of file Instruction.cpp.
bool Instruction::isLifetimeStartOrEnd | ( | ) | const |
Return true if the instruction is a llvm.lifetime.start or llvm.lifetime.end marker.
Definition at line 1231 of file Instruction.cpp.
References assert(), llvm::sandboxir::Context::createBinaryOperator(), llvm::IRBuilderBase::CreateBinOp(), llvm::sandboxir::Value::Ctx, llvm::sandboxir::getLLVMBinaryOp(), LHS, Name, RHS, and llvm::sandboxir::Instruction::setInsertPos().
|
inline |
Return true if this is a logical shift left or a logical shift right.
Definition at line 356 of file Instruction.h.
References getOpcode().
Referenced by canEvaluateShiftedShift(), and canShiftBinOpWithConstantRHS().
|
inline |
Return true if the instruction is nilpotent:
Nilpotent operators satisfy: x op x === Id,
where Id is the identity for the operator, i.e. a constant such that x op Id === x and Id op x === x for all x.
In LLVM, the Xor operator is nilpotent.
Definition at line 796 of file Instruction.h.
References getOpcode(), and isNilpotent().
Referenced by isNilpotent().
Definition at line 797 of file Instruction.h.
References llvm::Xor.
bool Instruction::isOnlyUserOfAnyOperand | ( | ) |
It checks if this instruction is the only user of at least one of its operands.
Definition at line 383 of file Instruction.cpp.
References assert(), Idx, and llvm::sandboxir::User::setOperand().
bool Instruction::isSafeToRemove | ( | ) | const |
Return true if the instruction can be removed if the result is unused.
When constant folding some instructions cannot be removed even if their results are unused. Specifically terminator instructions and calls that may have side effects cannot be removed without semantically changing the generated program.
Definition at line 1216 of file Instruction.cpp.
bool Instruction::isSameOperationAs | ( | const Instruction * | I, |
unsigned | flags = 0 |
||
) | const |
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.
Definition at line 975 of file Instruction.cpp.
Referenced by llvm::InstCombinerImpl::foldSelectOpOp().
|
inline |
Definition at line 320 of file Instruction.h.
References getOpcode(), and isShift().
Referenced by detectShiftUntilZeroIdiom(), llvm::InstCombinerImpl::foldICmpAndShift(), llvm::InstCombinerImpl::foldSelectShuffle(), foldSelectShuffleWith1Binop(), llvm::ARMTTIImpl::getArithmeticInstrCost(), llvm::PatternMatch::is_shift_op::isOpType(), isShift(), rightDistributesOverLeft(), and llvm::InstCombinerImpl::SimplifyDemandedVectorElts().
Determine if the Opcode is one of the shift instructions.
Definition at line 351 of file Instruction.h.
|
inline |
Definition at line 323 of file Instruction.h.
References getOpcode(), and isSpecialTerminator().
Referenced by isSpecialTerminator(), llvm::JumpThreadingPass::maybeMergeBasicBlockIntoOnlyPred(), and llvm::MergeBlockIntoPredecessor().
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).
Definition at line 387 of file Instruction.h.
|
inline |
Definition at line 315 of file Instruction.h.
References getOpcode(), and isTerminator().
Referenced by CalculateUnswitchCostMultiplier(), findLocationForEntrySafepoint(), llvm::MustBeExecutedContextExplorer::getMustBeExecutedNextInstruction(), llvm::isCriticalEdge(), isRemovableWrite(), isSafeToMove(), isTerminator(), llvm::InstDeleterIRStrategy::mutate(), llvm::MemoryDependenceResults::removeInstruction(), and llvm::OutlinableRegion::splitCandidate().
Definition at line 331 of file Instruction.h.
|
inline |
Definition at line 316 of file Instruction.h.
References getOpcode(), and isUnaryOp().
Referenced by llvm::ConstantFoldUnaryInstruction(), llvm::ConstantFoldUnaryOpOperand(), llvm::IRBuilderBase::CreateNAryOp(), llvm::isSafeToSpeculativelyExecuteWithOpcode(), and isUnaryOp().
Definition at line 335 of file Instruction.h.
bool Instruction::isUsedOutsideOfBlock | ( | const BasicBlock * | BB | ) | const |
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.
Definition at line 1000 of file Instruction.cpp.
Referenced by removeEmptyCleanup().
bool Instruction::isVolatile | ( | ) | const |
Return true if this instruction has a volatile memory access.
Definition at line 1097 of file Instruction.cpp.
References llvm::IRBuilderBase::CreateSwitch(), llvm::sandboxir::Context::createSwitchInst(), llvm::sandboxir::Value::Ctx, LLVMSwitch, llvm::sandboxir::Instruction::setInsertPos(), and llvm::sandboxir::Value::Val.
Referenced by llvm::CallBase::getMemoryEffects(), llvm::MemoryDependenceResults::getNonLocalPointerDependency(), and llvm::MemoryDependenceResults::getSimplePointerDependencyFrom().
LLVM_ABI llvm::Instruction::LLVM_DEPRECATED | ( | "Use iterators as instruction positions" | , |
"" | |||
) |
Insert an unlinked instruction into a basic block immediately before the specified instruction.
Deprecated in favour of the iterator-accepting flavour. Iterators at the start of a block such as BasicBlock::getFirstNonPHIIt must be passed into insertBefore without unwrapping/rewrapping. For all other positions, call getIterator to fetch the instruction iterator.
LLVM_ABI llvm::Instruction::LLVM_DEPRECATED | ( | "Use iterators as instruction positions" | , |
"" | |||
) |
Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right before MovePos.
Deprecated in favour of the iterator-accepting flavour. Iterators at the start of a block such as BasicBlock::getFirstNonPHIIt must be passed into moveBefore without unwrapping/rewrapping. For all other positions, call getIterator to fetch the instruction iterator.
LLVM_ABI llvm::Instruction::LLVM_DEPRECATED | ( | "Use iterators as instruction positions" | , |
"" | |||
) |
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.
Deprecated in favour of the iterator-accepting flavour of moveBeforePreserving, as all insertions should be at iterator positions.
bool Instruction::mayHaveSideEffects | ( | ) | const |
Return true if the instruction may have side effects.
Side effects are:
Note that this does not consider malloc and alloca to have side effects because the newly allocated memory is completely invisible to instructions which don't use the returned value. For cases where this matters, isSafeToSpeculativelyExecute may be more appropriate.
Definition at line 1212 of file Instruction.cpp.
Referenced by canMoveAboveCall(), llvm::deleteDeadLoop(), hasHardUserWithinLoop(), isSafePHIToSpeculate(), and llvm::MergeBlockIntoPredecessor().
bool Instruction::mayReadFromMemory | ( | ) | const |
Return true if this instruction may read memory.
Definition at line 1018 of file Instruction.cpp.
Referenced by GetLocation(), IsAcceptableTarget(), llvm::Dependence::isAnti(), llvm::Dependence::isFlow(), and llvm::Dependence::isInput().
|
inline |
Return true if this instruction may read or write memory.
Definition at line 808 of file Instruction.h.
Referenced by llvm::AliasSetTracker::addUnknown(), llvm::AliasSet::aliasesUnknownInst(), llvm::AAResults::getModRefInfo(), and llvm::intersectAccessGroups().
Return true if this instruction may throw an exception.
If IncludePhaseOneUnwind is set, this will also include cases where phase one unwinding may unwind past this frame due to skipping of cleanup landingpads.
Definition at line 1185 of file Instruction.cpp.
Referenced by isSafeToMove().
bool Instruction::mayWriteToMemory | ( | ) | const |
Return true if this instruction may modify memory.
Definition at line 1038 of file Instruction.cpp.
Referenced by llvm::findAvailablePtrLoadStore(), findInitTrampolineFromBB(), GetLocation(), llvm::Dependence::isAnti(), llvm::Dependence::isFlow(), llvm::Dependence::isOutput(), isSafeToMove(), and llvm::MemoryWriteTracking::isSpecialInstruction().
void Instruction::mergeDIAssignID | ( | ArrayRef< const Instruction * > | SourceInstructions | ) |
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.
Definition at line 901 of file DebugInfo.cpp.
References assert(), llvm::drop_begin(), llvm::SmallVectorBase< Size_T >::empty(), getFunction(), getMetadata(), I, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::at::RAUW(), and setMetadata().
Referenced by llvm::InstCombinerImpl::mergeStoreIntoSuccessor().
void Instruction::moveAfter | ( | InstListType::iterator | MovePos | ) |
Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right after MovePos.
Definition at line 204 of file Instruction.cpp.
void Instruction::moveAfter | ( | Instruction * | MovePos | ) |
Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right after MovePos.
Definition at line 196 of file Instruction.cpp.
References B, llvm::sandboxir::Value::Ctx, llvm::sandboxir::Tracker::emplaceIfTracking(), llvm::sandboxir::Context::getTracker(), and llvm::sandboxir::Value::Val.
Referenced by llvm::slpvectorizer::BoUpSLP::vectorizeTree().
void Instruction::moveAfterPreserving | ( | Instruction * | MovePos | ) |
See moveBeforePreserving .
Definition at line 211 of file Instruction.cpp.
void Instruction::moveBefore | ( | BasicBlock & | BB, |
InstListType::iterator | I | ||
) |
Unlink this instruction and insert into BB before I.
Definition at line 219 of file Instruction.cpp.
void Instruction::moveBefore | ( | InstListType::iterator | InsertPos | ) |
Unlink this instruction from its current basic block and insert it into the basic block that MovePos lives in, right before MovePos.
Definition at line 184 of file Instruction.cpp.
Referenced by llvm::CodeExtractor::extractCodeRegion(), llvm::InstCombinerImpl::freezeOtherUses(), NegateValue(), optimizeBranch(), removeEmptyCleanup(), llvm::setWidenableBranchCond(), simplifyRelocatesOffABase(), SinkInstruction(), sinkLastInstruction(), llvm::coro::sinkSpillUsesAfterCoroBegin(), turnGuardIntoBranch(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), versionCallSiteWithCond(), llvm::InstCombinerImpl::visitAllocaInst(), llvm::InstCombinerImpl::visitCallInst(), and llvm::widenWidenableBranch().
void Instruction::moveBeforePreserving | ( | BasicBlock & | BB, |
InstListType::iterator | I | ||
) |
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.
Definition at line 223 of file Instruction.cpp.
void Instruction::moveBeforePreserving | ( | InstListType::iterator | MovePos | ) |
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.
Definition at line 192 of file Instruction.cpp.
Referenced by llvm::MergeBlockIntoPredecessor(), and raiseUserConstantDataAllocasToEntryBlock().
|
delete |
void Instruction::removeFromParent | ( | ) |
This method unlinks 'this' from the containing basic block, but does not delete it.
Definition at line 90 of file Instruction.cpp.
Referenced by llvm::SITargetLowering::emitExpandAtomicAddrSpacePredicate(), llvm::InstCombinerImpl::matchBSwapOrBitReverse(), rewritePHIsForCleanupPad(), and llvm::JumpThreadingPass::unfoldSelectInstr().
void Instruction::replaceSuccessorWith | ( | BasicBlock * | OldBB, |
BasicBlock * | NewBB | ||
) |
Replace specified successor OldBB to point at the provided block.
This instruction must be a terminator.
Definition at line 1316 of file Instruction.cpp.
Referenced by insertUniqueBackedgeBlock().
Sets the AA metadata on this instruction from the AAMDNodes structure.
Definition at line 1804 of file Metadata.cpp.
References N, and setMetadata().
Referenced by llvm::IRBuilderBase::CreateElementUnorderedAtomicMemMove(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemSet(), llvm::IRBuilderBase::CreateMemSet(), llvm::IRBuilderBase::CreateMemSetInline(), doPromotion(), foldConsecutiveLoads(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), llvm::promoteLoopAccessesToScalars(), llvm::InstCombinerImpl::SimplifyAnyMemTransfer(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), speculateSelectInstLoads(), unpackLoadToAggregate(), unpackStoreToAggregate(), and llvm::InstCombinerImpl::visitExtractValueInst().
|
inline |
Set the debug location information for this instruction.
Definition at line 510 of file Instruction.h.
References llvm::DebugLoc::getCopied().
Referenced by addBoundsChecking(), applyFirstDebugLoc(), applyMergedLocation(), buildClonedLoopBlocks(), cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), llvm::createCallMatchingInvoke(), llvm::DbgVariableRecord::createDebugIntrinsic(), createFFSIntrinsic(), createPopcntIntrinsic(), llvm::OpenMPIRBuilder::createTask(), createUnreachableSwitchDefault(), DoFlattenLoopPair(), dropLocation(), llvm::OpenMPIRBuilder::emitTargetTask(), fixupDebugInfoPostExtraction(), foldCondBranchOnValueKnownInPredecessorImpl(), llvm::InstCombinerImpl::foldOpIntoPhi(), formLCSSAForInstructionsImpl(), generateReproducer(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleByValArgument(), HandleByValArgumentInit(), INITIALIZE_PASS(), llvm::InlineFunctionImpl(), insertCall(), insertUniqueBackedgeBlock(), llvm::AMDGPU::instrumentAddressImpl(), LowerNegateToMultiply(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), NegateValue(), optimizeDivRem(), OptimizeExtractBits(), performBlockTailMerging(), llvm::InstCombinerImpl::PHIArgMergedDebugLoc(), llvm::JumpThreadingPass::processBlock(), processCall(), llvm::JumpThreadingPass::processImpliedCondition(), processInternalGlobal(), processSaturatingInst(), llvm::JumpThreadingPass::processThreadableEdges(), llvm::promoteLoopAccessesToScalars(), llvm::SCCPSolver::removeNonFeasibleEdges(), llvm::removeUnwindEdge(), replaceArgumentUses(), replaceConditionalBranchesOnConstant(), llvm::replaceSignedInst(), llvm::setProbeDistributionFactor(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), sinkAndCmp0Expression(), sinkCmpExpression(), SinkShiftAndTruncate(), llvm::SplitBlockAndInsertIfThenElse(), SplitBlockPredecessorsImpl(), splitCallSite(), llvm::SplitIndirectBrCriticalEdges(), llvm::SplitKnownCriticalEdge(), SplitLandingPadPredecessorsImpl(), llvm::splitLoopBound(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadGuard(), tryToShorten(), TryToShrinkGlobalToBoolean(), llvm::JumpThreadingPass::tryToUnfoldSelectInCurrBB(), llvm::UnrollRuntimeLoopRemainder(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), unswitchTrivialSwitch(), and updateForIncomingValueLocation().
void Instruction::setFast | ( | bool | B | ) |
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.
Definition at line 588 of file Instruction.cpp.
Referenced by llvm::InstModificationIRStrategy::mutate().
void Instruction::setFastMathFlags | ( | FastMathFlags | FMF | ) |
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.
Definition at line 628 of file Instruction.cpp.
Referenced by CreateAdd(), CreateMul(), llvm::BinaryOperator::CreateWithFMF(), llvm::InstCombinerImpl::foldSelectOpOp(), llvm::InstCombinerImpl::SimplifyAssociativeOrCommutative(), and llvm::InstCombinerImpl::visitFNeg().
void Instruction::setHasAllowContract | ( | bool | B | ) |
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.
Definition at line 618 of file Instruction.cpp.
Referenced by llvm::InstModificationIRStrategy::mutate().
void Instruction::setHasAllowReassoc | ( | bool | B | ) |
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.
Definition at line 593 of file Instruction.cpp.
Referenced by llvm::InstModificationIRStrategy::mutate().
void Instruction::setHasAllowReciprocal | ( | bool | B | ) |
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.
Definition at line 613 of file Instruction.cpp.
Referenced by llvm::InstModificationIRStrategy::mutate().
void Instruction::setHasApproxFunc | ( | bool | B | ) |
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.
Definition at line 623 of file Instruction.cpp.
Referenced by llvm::InstModificationIRStrategy::mutate().
void Instruction::setHasNoInfs | ( | bool | B | ) |
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.
Definition at line 603 of file Instruction.cpp.
Referenced by foldFNegIntoConstant(), llvm::InstCombinerImpl::foldSelectIntoOp(), and llvm::InstModificationIRStrategy::mutate().
void Instruction::setHasNoNaNs | ( | bool | B | ) |
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.
Definition at line 598 of file Instruction.cpp.
Referenced by llvm::InstCombinerImpl::foldSelectIntoOp(), and llvm::InstModificationIRStrategy::mutate().
void Instruction::setHasNoSignedWrap | ( | bool | b = true | ) |
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.
Definition at line 394 of file Instruction.cpp.
Referenced by llvm::InstCombinerImpl::commonShiftTransforms(), llvm::BinaryOperator::CreateNSW(), llvm::InstCombinerImpl::foldAddWithConstant(), foldCttzCtlz(), foldIntrinsicUsingDistributiveLaws(), foldShiftedShift(), llvm::ConstantExpr::getAsInstruction(), llvm::SCEVExpander::hoistIVInc(), llvm::InstModificationIRStrategy::mutate(), NegateValue(), llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(), llvm::refineInstruction(), simplifyIRemMulShl(), llvm::InstCombinerImpl::visitMul(), and llvm::InstCombinerImpl::visitSub().
void Instruction::setHasNoSignedZeros | ( | bool | B | ) |
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.
Definition at line 608 of file Instruction.cpp.
Referenced by foldFNegIntoConstant(), llvm::InstCombinerImpl::foldSelectIntoOp(), llvm::InstModificationIRStrategy::mutate(), and llvm::InstCombinerImpl::visitFNeg().
void Instruction::setHasNoUnsignedWrap | ( | bool | b = true | ) |
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.
Definition at line 387 of file Instruction.cpp.
References llvm::sandboxir::Context::getValue().
Referenced by llvm::InstCombinerImpl::commonShiftTransforms(), llvm::BinaryOperator::CreateNUW(), llvm::InstCombinerImpl::foldAddWithConstant(), foldCttzCtlz(), foldIntrinsicUsingDistributiveLaws(), foldShiftedShift(), llvm::ConstantExpr::getAsInstruction(), llvm::SCEVExpander::hoistIVInc(), llvm::InstModificationIRStrategy::mutate(), NegateValue(), llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(), llvm::refineInstruction(), simplifyIRemMulShl(), llvm::InstCombinerImpl::visitMul(), and llvm::InstCombinerImpl::visitSub().
void Instruction::setIsExact | ( | bool | b = true | ) |
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.
Definition at line 401 of file Instruction.cpp.
Referenced by llvm::InstCombinerImpl::commonIDivTransforms(), llvm::InstCombinerImpl::commonShiftTransforms(), llvm::BinaryOperator::CreateExact(), llvm::InstCombinerImpl::EvaluateInDifferentType(), foldShiftedShift(), llvm::ConstantExpr::getAsInstruction(), llvm::InstModificationIRStrategy::mutate(), llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(), llvm::replaceSignedInst(), llvm::InstCombinerImpl::SimplifyDemandedUseBits(), llvm::InstCombinerImpl::visitAShr(), llvm::InstCombinerImpl::visitSDiv(), and llvm::InstCombinerImpl::visitUDiv().
Definition at line 1652 of file Metadata.cpp.
References llvm::Value::getContext(), hasMetadata(), and 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.
Definition at line 1718 of file Metadata.cpp.
References assert(), hasMetadata(), and llvm::Value::setMetadata().
Referenced by AddAliasScopeMetadata(), addAnnotationMetadata(), addBasicBlockMetadata(), llvm::LoopVersioning::annotateInstWithNoAlias(), llvm::annotateValueSite(), llvm::memprof::CallStackTrie::buildAndAttachMIBMetadata(), combineStoreToNewValue(), llvm::ConstantFoldTerminator(), convertFSqrtDivIntoFMul(), copyMetadataForAtomic(), llvm::copyMetadataForLoad(), llvm::copyNonnullMetadata(), llvm::copyRangeMetadata(), llvm::createCallMatchingInvoke(), llvm::IRBuilderBase::CreatePreserveArrayAccessIndex(), llvm::IRBuilderBase::CreatePreserveStructAccessIndex(), llvm::IRBuilderBase::CreatePreserveUnionAccessIndex(), llvm::SITargetLowering::emitExpandAtomicAddrSpacePredicate(), findBasePointer(), handlePhiDef(), insertNewDbgInst(), insertUniqueBackedgeBlock(), markLoadsAsInvariant(), mergeDIAssignID(), migrateDebugInfo(), llvm::MetadataLoader::MetadataLoaderImpl::parseMetadataAttachment(), performBranchToCommonDestFolding(), llvm::promoteCall(), propagateMemProfHelper(), llvm::propagateMetadata(), setAAMetadata(), llvm::setIrrLoopHeaderMetadata(), llvm::setLoopEstimatedTripCount(), setMetadata(), setNoSanitizeMetadata(), llvm::InstCombinerImpl::SimplifyAnyMemTransfer(), llvm::SplitBlockAndInsertIfThenElse(), SplitBlockPredecessorsImpl(), llvm::SplitKnownCriticalEdge(), translateBranchMetadata(), unswitchNontrivialInvariants(), upgradeAMDGCNIntrinsicCall(), upgradeX86IntrinsicCall(), and llvm::InstCombinerImpl::visitFMul().
void Instruction::setNonNeg | ( | bool | b = true | ) |
Set or clear the nneg flag on this instruction, which must be a zext instruction.
Definition at line 405 of file Instruction.cpp.
References llvm::sandboxir::Context::createLoadInst(), llvm::sandboxir::Value::Ctx, llvm::sandboxir::Type::LLVMTy, Name, Ptr, and llvm::sandboxir::Instruction::setInsertPos().
Referenced by llvm::refineInstruction(), llvm::replaceSignedInst(), llvm::InstCombinerImpl::visitUIToFP(), and llvm::InstCombinerImpl::visitZExt().
void Instruction::setNoSanitizeMetadata | ( | ) |
Sets the nosanitize metadata on this instruction.
Definition at line 1812 of file Metadata.cpp.
References llvm::MDNode::get(), llvm::Value::getContext(), and setMetadata().
|
inlineprotected |
Definition at line 1062 of file Instruction.h.
void Instruction::setSuccessor | ( | unsigned | Idx, |
BasicBlock * | BB | ||
) |
Update the specified successor to point at the provided block.
This instruction must be a terminator.
Definition at line 1304 of file Instruction.cpp.
Referenced by cloneLoopBlocks(), CloneLoopBlocks(), llvm::createMemCpyLoopKnownSize(), llvm::lowerUnaryVectorIntrinsicAsLoop(), llvm::SplitKnownCriticalEdge(), llvm::JumpThreadingPass::threadEdge(), and llvm::JumpThreadingPass::threadThroughTwoBasicBlocks().
void Instruction::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.
Definition at line 1327 of file Instruction.cpp.
Referenced by llvm::BranchInst::swapSuccessors().
void Instruction::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.
Definition at line 930 of file DebugInfo.cpp.
References dropLocation().
|
inline |
Specialize the methods defined in Value, as we know that an instruction can only be used by other instructions.
Definition at line 171 of file Instruction.h.
Referenced by foldInsSequenceIntoSplat(), llvm::InstCombinerImpl::foldIntegerTypedPHI(), llvm::ARMTTIImpl::getArithmeticInstrCost(), llvm::ARMTTIImpl::getCmpSelInstrCost(), llvm::LoopVectorizationCostModel::getReductionPatternCost(), isNotUsedOrFoldableInLoop(), promoteSingleBlockAlloca(), replaceExtractElements(), shouldExpandCmpArithRMWInIR(), llvm::InstCombinerImpl::SliceUpIllegalIntegerPHI(), speculatePHINodeLoads(), llvm::FastISel::tryToFoldLoad(), llvm::InstCombinerImpl::visitPHINode(), llvm::InstCombinerImpl::visitSExt(), and llvm::InstCombinerImpl::visitZExt().
|
inline |
Definition at line 172 of file Instruction.h.
bool Instruction::willReturn | ( | ) | const |
Return true if the instruction will return (unwinding is considered as a form of returning control flow here).
Definition at line 1221 of file Instruction.cpp.
Referenced by isRemovableWrite(), and isSafeToMove().
|
friend |
Various leaf nodes.
Definition at line 1036 of file Instruction.h.
|
friend |
Definition at line 977 of file Instruction.h.
DbgMarker* llvm::Instruction::DebugMarker = nullptr |
Optional marker recording the position for debugging information that takes effect immediately before this instruction.
Null unless there is debugging information present.
Definition at line 85 of file Instruction.h.
Referenced by llvm::DbgMarker::removeFromParent(), and llvm::DbgMarker::removeMarker().