LLVM 19.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Friends | List of all members
llvm::Instruction Class Reference

#include "llvm/IR/Instruction.h"

Inheritance diagram for llvm::Instruction:
Inheritance graph
[legend]

Public Types

enum  OperationEquivalenceFlags { CompareIgnoringAlignment = 1<<0 , CompareUsingScalarTypes = 1<<1 }
 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 > >
 
- Public Types inherited from llvm::User
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 >
 
- Public Types inherited from llvm::Value
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

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.
 
std::optional< simple_ilist< DbgRecord >::iterator > getDbgReinsertionPosition ()
 Return an iterator to the position of the "Next" DbgRecord after this instruction, or std::nullopt.
 
bool hasDbgRecords () const
 Returns true if any DbgRecords are attached to this instruction.
 
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.
 
void dropDbgRecords ()
 Erase any DbgRecords attached to this instruction.
 
void dropOneDbgRecord (DbgRecord *I)
 Erase a single DbgRecord I that is attached to this instruction.
 
void handleMarkerRemoval ()
 Handle the debug-info implications of this instruction being removed.
 
 Instruction (const Instruction &)=delete
 
Instructionoperator= (const Instruction &)=delete
 
Instructionuser_back ()
 Specialize the methods defined in Value, as we know that an instruction can only be used by other instructions.
 
const Instructionuser_back () const
 
const BasicBlockgetParent () const
 
BasicBlockgetParent ()
 
const ModulegetModule () const
 Return the module owning the function this instruction belongs to or nullptr it the function does not have a module.
 
ModulegetModule ()
 
const FunctiongetFunction () const
 Return the function this instruction belongs to.
 
FunctiongetFunction ()
 
void removeFromParent ()
 This method unlinks 'this' from the containing basic block, but does not delete it.
 
InstListType::iterator eraseFromParent ()
 This method unlinks 'this' from the containing basic block and deletes it.
 
void insertBefore (Instruction *InsertPos)
 Insert an unlinked instruction into a basic block immediately before the specified instruction.
 
void insertBefore (InstListType::iterator InsertPos)
 Insert an unlinked instruction into a basic block immediately before the specified instruction.
 
void insertAfter (Instruction *InsertPos)
 Insert an unlinked instruction into a basic block immediately after the specified instruction.
 
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.
 
void insertBefore (BasicBlock &BB, InstListType::iterator InsertPos)
 
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.
 
void moveBeforePreserving (Instruction *MovePos)
 Perform a moveBefore operation, while signalling that the caller intends to preserve the original ordering of instructions.
 
void moveBefore (BasicBlock &BB, InstListType::iterator I)
 Unlink this instruction and insert into BB before I.
 
void moveBeforePreserving (BasicBlock &BB, InstListType::iterator I)
 (See other overload for moveBeforePreserving).
 
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.
 
void moveAfterPreserving (Instruction *MovePos)
 See moveBeforePreserving .
 
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.
 
std::optional< InstListType::iteratorgetInsertionPointAfterDef ()
 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 chargetOpcodeName () const
 
bool isTerminator () const
 
bool isUnaryOp () const
 
bool isBinaryOp () const
 
bool isIntDivRem () const
 
bool isShift () const
 
bool isCast () const
 
bool isFuncletPad () const
 
bool isSpecialTerminator () const
 
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.
 
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.
 
MDNodegetMetadata (unsigned KindID) const
 Get the metadata of given kind attached to this Instruction.
 
MDNodegetMetadata (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.
 
void setMetadata (unsigned KindID, MDNode *Node)
 Set the metadata of the specified kind to the specified node.
 
void setMetadata (StringRef Kind, MDNode *Node)
 
void copyMetadata (const Instruction &SrcInst, ArrayRef< unsigned > WL=ArrayRef< unsigned >())
 Copy metadata from SrcInst to this instruction.
 
void eraseMetadataIf (function_ref< bool(unsigned, MDNode *)> Pred)
 Erase all metadata that matches the predicate.
 
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.
 
void addAnnotationMetadata (StringRef Annotation)
 Adds an !annotation metadata node with Annotation to this instruction.
 
void addAnnotationMetadata (SmallVector< StringRef > Annotations)
 Adds an !annotation metadata node with an array of Annotations as a tuple to this instruction.
 
AAMDNodes getAAMetadata () const
 Returns the AA metadata for this instruction.
 
void setAAMetadata (const AAMDNodes &N)
 Sets the AA metadata on this instruction from the AAMDNodes structure.
 
void setNoSanitizeMetadata ()
 Sets the nosanitize metadata on this instruction.
 
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 DebugLocgetDebugLoc () const
 Return the debug location for this node as a DebugLoc.
 
const DebugLocgetStableDebugLoc () 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.
 
void setHasNoUnsignedWrap (bool b=true)
 Set or clear the nuw flag on this instruction, which must be an operator which supports this flag.
 
void setHasNoSignedWrap (bool b=true)
 Set or clear the nsw flag on this instruction, which must be an operator which supports this flag.
 
void setIsExact (bool b=true)
 Set or clear the exact flag on this instruction, which must be an operator which supports this flag.
 
void setNonNeg (bool b=true)
 Set or clear the nneg flag on this instruction, which must be a zext instruction.
 
bool hasNoUnsignedWrap () const LLVM_READONLY
 Determine whether the no unsigned wrap flag is set.
 
bool hasNoSignedWrap () const LLVM_READONLY
 Determine whether the no signed wrap flag is set.
 
bool hasNonNeg () const LLVM_READONLY
 Determine whether the the nneg flag is set.
 
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.
 
void dropPoisonGeneratingFlags ()
 Drops flags that may cause this instruction to evaluate to poison despite having non-poison inputs.
 
bool hasPoisonGeneratingMetadata () const LLVM_READONLY
 Return true if this instruction has poison-generating metadata.
 
void dropPoisonGeneratingMetadata ()
 Drops metadata that may generate poison.
 
bool hasPoisonGeneratingFlagsOrMetadata () const
 Return true if this instruction has poison-generating flags or metadata.
 
void dropPoisonGeneratingFlagsAndMetadata ()
 Drops flags and metadata that may generate poison.
 
void dropUBImplyingAttrsAndUnknownMetadata (ArrayRef< unsigned > KnownIDs={})
 This function drops non-debug unknown metadata (through dropUnknownNonDebugMetadata).
 
void dropUBImplyingAttrsAndMetadata ()
 Drop any attributes or metadata that can cause immediate undefined behavior.
 
bool isExact () const LLVM_READONLY
 Determine whether the exact flag is set.
 
void setFast (bool B)
 Set or clear all fast-math-flags on this instruction, which must be an operator which supports this flag.
 
void setHasAllowReassoc (bool B)
 Set or clear the reassociation flag on this instruction, which must be an operator which supports this flag.
 
void setHasNoNaNs (bool B)
 Set or clear the no-nans flag on this instruction, which must be an operator which supports this flag.
 
void setHasNoInfs (bool B)
 Set or clear the no-infs flag on this instruction, which must be an operator which supports this flag.
 
void setHasNoSignedZeros (bool B)
 Set or clear the no-signed-zeros flag on this instruction, which must be an operator which supports this flag.
 
void setHasAllowReciprocal (bool B)
 Set or clear the allow-reciprocal flag on this instruction, which must be an operator which supports this flag.
 
void setHasAllowContract (bool B)
 Set or clear the allow-contract flag on this instruction, which must be an operator which supports this flag.
 
void setHasApproxFunc (bool B)
 Set or clear the approximate-math-functions flag on this instruction, which must be an operator which supports this flag.
 
void setFastMathFlags (FastMathFlags FMF)
 Convenience function for setting multiple fast-math flags on this instruction, which must be an operator which supports these flags.
 
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.
 
bool isFast () const LLVM_READONLY
 Determine whether all fast-math-flags are set.
 
bool hasAllowReassoc () const LLVM_READONLY
 Determine whether the allow-reassociation flag is set.
 
bool hasNoNaNs () const LLVM_READONLY
 Determine whether the no-NaNs flag is set.
 
bool hasNoInfs () const LLVM_READONLY
 Determine whether the no-infs flag is set.
 
bool hasNoSignedZeros () const LLVM_READONLY
 Determine whether the no-signed-zeros flag is set.
 
bool hasAllowReciprocal () const LLVM_READONLY
 Determine whether the allow-reciprocal flag is set.
 
bool hasAllowContract () const LLVM_READONLY
 Determine whether the allow-contract flag is set.
 
bool hasApproxFunc () const LLVM_READONLY
 Determine whether the approximate-math-functions flag is set.
 
FastMathFlags getFastMathFlags () const LLVM_READONLY
 Convenience function for getting all the fast-math flags, which must be an operator which supports these flags.
 
void copyFastMathFlags (const Instruction *I)
 Copy I's fast-math flags.
 
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.
 
void andIRFlags (const Value *V)
 Logical 'and' of any supported wrapping, exact, and fast-math flags of V and this instruction.
 
void applyMergedLocation (DILocation *LocA, DILocation *LocB)
 Merge 2 debug locations and apply it to the Instruction.
 
void updateLocationAfterHoist ()
 Updates the debug location given that the instruction has been hoisted from a block to a predecessor of that block.
 
void dropLocation ()
 Drop the instruction's debug location.
 
void mergeDIAssignID (ArrayRef< const Instruction * > SourceInstructions)
 Merge the DIAssignID metadata from this instruction and those attached to instructions in SourceInstructions.
 
bool isAssociative () const LLVM_READONLY
 Return true if the instruction is associative:
 
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:
 
bool mayWriteToMemory () const LLVM_READONLY
 Return true if this instruction may modify memory.
 
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.
 
bool isAtomic () const LLVM_READONLY
 Return true if this instruction has an AtomicOrdering of unordered or higher.
 
bool hasAtomicLoad () const LLVM_READONLY
 Return true if this atomic instruction loads from memory.
 
bool hasAtomicStore () const LLVM_READONLY
 Return true if this atomic instruction stores to memory.
 
bool isVolatile () const LLVM_READONLY
 Return true if this instruction has a volatile memory access.
 
TypegetAccessType () const LLVM_READONLY
 Return the type this instruction accesses in memory, if any.
 
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.
 
bool mayHaveSideEffects () const LLVM_READONLY
 Return true if the instruction may have side effects.
 
bool isSafeToRemove () const LLVM_READONLY
 Return true if the instruction can be removed if the result is unused.
 
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.
 
bool isLifetimeStartOrEnd () const LLVM_READONLY
 Return true if the instruction is a llvm.lifetime.start or llvm.lifetime.end marker.
 
bool isLaunderOrStripInvariantGroup () const LLVM_READONLY
 Return true if the instruction is a llvm.launder.invariant.group or llvm.strip.invariant.group.
 
bool isDebugOrPseudoInst () const LLVM_READONLY
 Return true if the instruction is a DbgInfoIntrinsic or PseudoProbeInst.
 
const InstructiongetNextNonDebugInstruction (bool SkipPseudoOp=false) const
 Return a pointer to the next non-debug instruction in the same basic block as 'this', or nullptr if no such instruction exists.
 
InstructiongetNextNonDebugInstruction (bool SkipPseudoOp=false)
 
const InstructiongetPrevNonDebugInstruction (bool SkipPseudoOp=false) const
 Return a pointer to the previous non-debug instruction in the same basic block as 'this', or nullptr if no such instruction exists.
 
InstructiongetPrevNonDebugInstruction (bool SkipPseudoOp=false)
 
Instructionclone () const
 Create a copy of 'this' instruction that is identical in all ways except the following:
 
bool isIdenticalTo (const Instruction *I) const LLVM_READONLY
 Return true if the specified instruction is exactly identical to the current one.
 
bool isIdenticalToWhenDefined (const Instruction *I) 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.
 
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.
 
bool hasSameSpecialState (const Instruction *I2, bool IgnoreAlignment=false) const LLVM_READONLY
 This function determines if the speficied instruction has the same "special" characteristics as the current one.
 
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.
 
unsigned getNumSuccessors () const LLVM_READONLY
 Return the number of successors that this instruction has.
 
BasicBlockgetSuccessor (unsigned Idx) const LLVM_READONLY
 Return the specified successor. This instruction must be a terminator.
 
void setSuccessor (unsigned Idx, BasicBlock *BB)
 Update the specified successor to point at the provided block.
 
void replaceSuccessorWith (BasicBlock *OldBB, BasicBlock *NewBB)
 Replace specified successor OldBB to point at the provided block.
 
void dropUnknownNonDebugMetadata (ArrayRef< unsigned > KnownIDs)
 Drop all unknown metadata except for debug locations.
 
void dropUnknownNonDebugMetadata ()
 
void dropUnknownNonDebugMetadata (unsigned ID1)
 
void dropUnknownNonDebugMetadata (unsigned ID1, unsigned ID2)
 
- Public Member Functions inherited from llvm::User
 User (const User &)=delete
 
void operator delete (void *Usr)
 Free memory allocated for User and Use objects.
 
void operator delete (void *Usr, unsigned)
 Placement delete - required by std, called if the ctor throws.
 
void operator delete (void *Usr, unsigned, unsigned)
 Placement delete - required by std, called if the ctor throws.
 
const UsegetOperandList () const
 
UsegetOperandList ()
 
ValuegetOperand (unsigned i) const
 
void setOperand (unsigned i, Value *Val)
 
const UsegetOperandUse (unsigned i) const
 
UsegetOperandUse (unsigned i)
 
unsigned getNumOperands () const
 
ArrayRef< const uint8_t > getDescriptor () const
 Returns the descriptor co-allocated with this User instance.
 
MutableArrayRef< uint8_t > getDescriptor ()
 Returns the descriptor co-allocated with this User instance.
 
void setGlobalVariableNumOperands (unsigned NumOps)
 Set the number of operands on a GlobalVariable.
 
void setNumHungOffUseOperands (unsigned NumOps)
 Subclasses with hung off uses need to manage the operand count themselves.
 
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_iteratoroperand_values ()
 
const_value_op_iterator value_op_begin () const
 
const_value_op_iterator value_op_end () const
 
iterator_range< const_value_op_iteratoroperand_values () const
 
void dropAllReferences ()
 Drop all references to operands.
 
bool replaceUsesOfWith (Value *From, Value *To)
 Replace uses of one Value with another.
 
- Public Member Functions inherited from llvm::Value
 Value (const Value &)=delete
 
Valueoperator= (const Value &)=delete
 
void deleteValue ()
 Delete a pointer to a generic Value.
 
void dump () const
 Support for debugging, callable in GDB: V->dump()
 
TypegetType () const
 All values are typed, get the type of this value.
 
LLVMContextgetContext () const
 All values hold a context through their type.
 
bool hasName () const
 
ValueNamegetValueName () const
 
void setValueName (ValueName *VN)
 
StringRef getName () const
 Return a constant reference to the value's name.
 
void setName (const Twine &Name)
 Change the name of the value.
 
void takeName (Value *V)
 Transfer the name from V to this value.
 
std::string getNameOrAsOperand () const
 
void replaceAllUsesWith (Value *V)
 Change all uses of this to point to a new Value.
 
void replaceNonMetadataUsesWith (Value *V)
 Change non-metadata uses of this to point to a new Value.
 
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.
 
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.
 
void assertModuleIsMaterializedImpl () const
 
void assertModuleIsMaterialized () const
 
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_iteratormaterialized_uses ()
 
iterator_range< const_use_iteratormaterialized_uses () const
 
iterator_range< use_iteratoruses ()
 
iterator_range< const_use_iteratoruses () 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
 
Useruser_back ()
 
const Useruser_back () const
 
iterator_range< user_iteratormaterialized_users ()
 
iterator_range< const_user_iteratormaterialized_users () const
 
iterator_range< user_iteratorusers ()
 
iterator_range< const_user_iteratorusers () const
 
bool hasOneUse () const
 Return true if there is exactly one use of this value.
 
bool hasNUses (unsigned N) const
 Return true if this Value has exactly N uses.
 
bool hasNUsesOrMore (unsigned N) const
 Return true if this value has N uses or more.
 
bool hasOneUser () const
 Return true if there is exactly one user of this value.
 
UsegetSingleUndroppableUse ()
 Return true if there is exactly one use of this value that cannot be dropped.
 
const UsegetSingleUndroppableUse () const
 
UsergetUniqueUndroppableUser ()
 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 UsergetUniqueUndroppableUser () const
 
bool hasNUndroppableUses (unsigned N) const
 Return true if there this value.
 
bool hasNUndroppableUsesOrMore (unsigned N) const
 Return true if this value has N uses or more.
 
void dropDroppableUses (llvm::function_ref< bool(const Use *)> ShouldDrop=[](const Use *) { return true;})
 Remove every uses that can safely be removed.
 
void dropDroppableUsesIn (User &Usr)
 Remove every use of this value in User that can safely be removed.
 
bool isUsedInBasicBlock (const BasicBlock *BB) const
 Check if this value is used in the specified basic block.
 
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.
 
bool isSwiftError () const
 Return true if this value is a swifterror value.
 
const ValuestripPointerCasts () const
 Strip off pointer casts, all-zero GEPs and address space casts.
 
ValuestripPointerCasts ()
 
const ValuestripPointerCastsAndAliases () const
 Strip off pointer casts, all-zero GEPs, address space casts, and aliases.
 
ValuestripPointerCastsAndAliases ()
 
const ValuestripPointerCastsSameRepresentation () const
 Strip off pointer casts, all-zero GEPs and address space casts but ensures the representation of the result stays the same.
 
ValuestripPointerCastsSameRepresentation ()
 
const ValuestripPointerCastsForAliasAnalysis () const
 Strip off pointer casts, all-zero GEPs, single-argument phi nodes and invariant group info.
 
ValuestripPointerCastsForAliasAnalysis ()
 
const ValuestripInBoundsConstantOffsets () const
 Strip off pointer casts and all-constant inbounds GEPs.
 
ValuestripInBoundsConstantOffsets ()
 
const ValuestripAndAccumulateConstantOffsets (const DataLayout &DL, APInt &Offset, bool AllowNonInbounds, bool AllowInvariantGroup=false, function_ref< bool(Value &Value, APInt &Offset)> ExternalAnalysis=nullptr) const
 Accumulate the constant offset this value has compared to a base pointer.
 
ValuestripAndAccumulateConstantOffsets (const DataLayout &DL, APInt &Offset, bool AllowNonInbounds, bool AllowInvariantGroup=false)
 
const ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const
 This is a wrapper around stripAndAccumulateConstantOffsets with the in-bounds requirement set to false.
 
ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset)
 
const ValuestripInBoundsOffsets (function_ref< void(const Value *)> Func=[](const Value *) {}) const
 Strip off pointer casts and inbounds GEPs.
 
ValuestripInBoundsOffsets (function_ref< void(const Value *)> Func=[](const Value *) {})
 
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.
 
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.
 
uint64_t getPointerDereferenceableBytes (const DataLayout &DL, bool &CanBeNull, bool &CanBeFreed) const
 Returns the number of bytes known to be dereferenceable for the pointer value.
 
Align getPointerAlignment (const DataLayout &DL) const
 Returns an alignment of the pointer value.
 
const ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const
 Translate PHI node to its predecessor from the given basic block.
 
ValueDoPHITranslation (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.
 
void reverseUseList ()
 Reverse the use-list.
 
void print (raw_ostream &O, bool IsForDebug=false) const
 Implement operator<< on Value.
 
void print (raw_ostream &O, ModuleSlotTracker &MST, bool IsForDebug=false) const
 
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.
 
void printAsOperand (raw_ostream &O, bool PrintType, ModuleSlotTracker &MST) const
 
- Public Member Functions inherited from llvm::ilist_node_with_parent< Instruction, BasicBlock, ilist_iterator_bits< true > >
InstructiongetPrevNode ()
 
const InstructiongetPrevNode () const
 Get the previous node, or nullptr for the list head.
 
InstructiongetNextNode ()
 Get the next node, or nullptr for the list tail.
 
const InstructiongetNextNode () const
 Get the next node, or nullptr for the list tail.
 
- Public Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >
self_iterator getIterator ()
 
const_self_iterator getIterator () const
 
reverse_self_iterator getReverseIterator ()
 
const_reverse_self_iterator getReverseIterator () const
 
bool isSentinel () const
 Check whether this is the sentinel node.
 

Static Public Member Functions

static const chargetOpcodeName (unsigned Opcode)
 
static bool isTerminator (unsigned Opcode)
 
static bool isUnaryOp (unsigned Opcode)
 
static bool isBinaryOp (unsigned Opcode)
 
static bool isIntDivRem (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 Public Member Functions inherited from llvm::User
static bool classof (const Value *V)
 
- Static Public Member Functions inherited from llvm::Value
static void dropDroppableUse (Use &U)
 Remove the droppable use U.
 

Public Attributes

DPMarkerDbgMarker = nullptr
 Optional marker recording the position for debugging information that takes effect immediately before this instruction.
 

Protected Types

using OpaqueField = Bitfield::Element< uint16_t, 0, 15 >
 
template<unsigned Offset>
using AlignmentBitfieldElementT = typename Bitfield::Element< unsigned, Offset, 6, Value::MaxAlignmentExponent >
 
template<unsigned Offset>
using BoolBitfieldElementT = typename Bitfield::Element< bool, Offset, 1 >
 
template<unsigned Offset>
using AtomicOrderingBitfieldElementT = typename Bitfield::Element< AtomicOrdering, Offset, 3, AtomicOrdering::LAST >
 
- Protected Types inherited from llvm::Value
enum  : unsigned { NumUserOperandsBits = 27 }
 The number of operands in the subclass. More...
 
- Protected Types inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >
using self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, ilist_detail::compute_node_options< T, Options... >::type, false, false >::type
 
using const_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, ilist_detail::compute_node_options< T, Options... >::type, false, true >::type
 
using reverse_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, ilist_detail::compute_node_options< T, Options... >::type, true, false >::type
 
using const_reverse_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, ilist_detail::compute_node_options< T, Options... >::type, true, true >::type
 

Protected Member Functions

 ~Instruction ()
 
template<typename BitfieldElement >
BitfieldElement::Type getSubclassData () const
 
template<typename BitfieldElement >
void setSubclassData (typename BitfieldElement::Type Value)
 
 Instruction (Type *Ty, unsigned iType, Use *Ops, unsigned NumOps, InstListType::iterator InsertBefore)
 
 Instruction (Type *Ty, unsigned iType, Use *Ops, unsigned NumOps, Instruction *InsertBefore=nullptr)
 
 Instruction (Type *Ty, unsigned iType, Use *Ops, unsigned NumOps, BasicBlock *InsertAtEnd)
 
- Protected Member Functions inherited from llvm::User
void * operator new (size_t Size)
 Allocate a User with an operand pointer co-allocated.
 
void * operator new (size_t Size, unsigned Us)
 Allocate a User with the operands co-allocated.
 
void * operator new (size_t Size, unsigned Us, unsigned DescBytes)
 Allocate a User with the operands co-allocated.
 
 User (Type *ty, unsigned vty, Use *, unsigned NumOps)
 
void allocHungoffUses (unsigned N, bool IsPhi=false)
 Allocate the array of Uses, followed by a pointer (with bottom bit set) to the User.
 
void growHungoffUses (unsigned N, bool IsPhi=false)
 Grow the number of hung off uses.
 
 ~User ()=default
 
template<int Idx>
UseOp ()
 
template<int Idx>
const UseOp () const
 
- Protected Member Functions inherited from llvm::Value
 Value (Type *Ty, unsigned scid)
 
 ~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.
 
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.
 
bool eraseMetadata (unsigned KindID)
 Erase all metadata attachments with the given kind.
 
void eraseMetadataIf (function_ref< bool(unsigned, MDNode *)> Pred)
 Erase all metadata attachments matching the given predicate.
 
void clearMetadata ()
 Erase all metadata attached to this Value.
 
MDNodegetMetadataImpl (unsigned KindID) const
 Get metadata for the given kind, if any.
 
unsigned short getSubclassDataFromValue () const
 
void setValueSubclassData (unsigned short D)
 
MDNodegetMetadata (unsigned KindID) const
 Get the current metadata attachments for the given kind, if any.
 
MDNodegetMetadata (StringRef Kind) const
 
void getMetadata (unsigned KindID, SmallVectorImpl< MDNode * > &MDs) const
 Appends all attachments with the given ID to MDs in insertion order.
 
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
 
void setMetadata (unsigned KindID, MDNode *Node)
 Set a particular kind of metadata attachment.
 
void setMetadata (StringRef Kind, MDNode *Node)
 
void addMetadata (unsigned KindID, MDNode &MD)
 Add a metadata attachment.
 
void addMetadata (StringRef Kind, MDNode &MD)
 
- Protected Member Functions inherited from llvm::ilist_node_with_parent< Instruction, BasicBlock, ilist_iterator_bits< true > >
 ilist_node_with_parent ()=default
 
- Protected Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >
 ilist_node_impl ()=default
 

Friends

class SymbolTableListTraits< Instruction, ilist_iterator_bits< true > >
 
class BasicBlock
 Various leaf nodes.
 

Additional Inherited Members

- Static Public Attributes inherited from llvm::Value
static constexpr unsigned MaxAlignmentExponent = 32
 The maximum alignment for instructions.
 
static constexpr uint64_t MaximumAlignment = 1ULL << MaxAlignmentExponent
 
- Static Protected Member Functions inherited from llvm::User
template<int Idx, typename U >
static UseOpFrom (const U *that)
 
- Protected Attributes inherited from llvm::Value
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
 

Detailed Description

Definition at line 46 of file Instruction.h.

Member Typedef Documentation

◆ AlignmentBitfieldElementT

Definition at line 122 of file Instruction.h.

◆ AtomicOrderingBitfieldElementT

Definition at line 130 of file Instruction.h.

◆ BoolBitfieldElementT

template<unsigned Offset>
using llvm::Instruction::BoolBitfieldElementT = typename Bitfield::Element<bool, Offset, 1>
protected

Definition at line 127 of file Instruction.h.

◆ InstListType

Definition at line 50 of file Instruction.h.

◆ OpaqueField

Definition at line 114 of file Instruction.h.

Member Enumeration Documentation

◆ BinaryOps

Definition at line 936 of file Instruction.h.

◆ CastOps

Definition at line 950 of file Instruction.h.

◆ FuncletPadOps

Definition at line 957 of file Instruction.h.

◆ MemoryOps

Definition at line 943 of file Instruction.h.

◆ OperationEquivalenceFlags

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.

Definition at line 865 of file Instruction.h.

◆ OtherOps

Definition at line 964 of file Instruction.h.

◆ TermOps

Definition at line 922 of file Instruction.h.

◆ UnaryOps

Definition at line 929 of file Instruction.h.

Constructor & Destructor Documentation

◆ ~Instruction()

Instruction::~Instruction ( )
protected

◆ Instruction() [1/4]

llvm::Instruction::Instruction ( const Instruction )
delete

◆ Instruction() [2/4]

Instruction::Instruction ( Type Ty,
unsigned  iType,
Use Ops,
unsigned  NumOps,
InstListType::iterator  InsertBefore 
)
protected

Definition at line 25 of file Instruction.cpp.

References assert(), llvm::BasicBlock::getParent(), and insertInto().

◆ Instruction() [3/4]

Instruction::Instruction ( Type Ty,
unsigned  iType,
Use Ops,
unsigned  NumOps,
Instruction InsertBefore = nullptr 
)
protected

◆ Instruction() [4/4]

Instruction::Instruction ( Type Ty,
unsigned  iType,
Use Ops,
unsigned  NumOps,
BasicBlock InsertAtEnd 
)
protected

Definition at line 47 of file Instruction.cpp.

References llvm::BasicBlock::end(), and insertInto().

Member Function Documentation

◆ addAnnotationMetadata() [1/2]

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 1656 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().

◆ addAnnotationMetadata() [2/2]

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 1686 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().

◆ adoptDbgRecords()

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 275 of file Instruction.cpp.

References llvm::DPMarker::absorbDebugValues(), llvm::BasicBlock::createMarker(), DbgMarker, llvm::BasicBlock::deleteTrailingDbgRecords(), llvm::BasicBlock::end(), llvm::DPMarker::eraseFromParent(), llvm::BasicBlock::getMarker(), getParent(), llvm::DPMarker::MarkedInstr, and llvm::DPMarker::StoredDbgRecords.

Referenced by insertBefore().

◆ andIRFlags()

void Instruction::andIRFlags ( const Value V)

◆ applyMergedLocation()

void Instruction::applyMergedLocation ( DILocation LocA,
DILocation LocB 
)

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 929 of file DebugInfo.cpp.

References llvm::DILocation::getMergedLocation(), and setDebugLoc().

Referenced by llvm::InstCombinerImpl::PHIArgMergedDebugLoc(), sinkLastInstruction(), and updateForIncomingValueLocation().

◆ classof()

static bool llvm::Instruction::classof ( const Value V)
inlinestatic

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition at line 915 of file Instruction.h.

◆ clone()

Instruction * Instruction::clone ( ) const

◆ cloneDebugInfoFrom()

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.

See also
DebugProgramInstruction.h , because the ordering of DbgRecords is still important, fine grain control of which instructions are moved and where they go is necessary. 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.
Returns
A range over the newly cloned DbgRecords.

Definition at line 243 of file Instruction.cpp.

References assert(), llvm::DPMarker::cloneDebugInfoFrom(), llvm::BasicBlock::createMarker(), DbgMarker, From, llvm::DPMarker::getEmptyDbgRecordRange(), and getParent().

Referenced by llvm::CloneBasicBlock(), llvm::JumpThreadingPass::cloneInstructions(), CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), and performBranchToCommonDestFolding().

◆ comesBefore()

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 327 of file Instruction.cpp.

References assert(), llvm::BasicBlock::isInstrOrderValid(), llvm::Other, and llvm::BasicBlock::renumberInstructions().

Referenced by domTreeLevelBefore(), llvm::InstructionPrecedenceTracking::isPreceededBySpecialInstruction(), llvm::isValidAssumeForContext(), llvm::BasicBlock::validateInstrOrdering(), and llvm::slpvectorizer::BoUpSLP::vectorizeTree().

◆ copyFastMathFlags() [1/2]

void Instruction::copyFastMathFlags ( const Instruction I)

Copy I's fast-math flags.

Definition at line 584 of file Instruction.cpp.

References copyFastMathFlags(), and I.

◆ copyFastMathFlags() [2/2]

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 534 of file Instruction.cpp.

References assert().

Referenced by andIRFlags(), copyFastMathFlags(), copyIRFlags(), modifyIntrinsicCall(), llvm::InstCombinerImpl::visitCallInst(), llvm::InstCombinerImpl::visitFNeg(), and llvm::InstCombinerImpl::visitFPTrunc().

◆ copyIRFlags()

void Instruction::copyIRFlags ( const Value V,
bool  IncludeWrapFlags = true 
)

◆ copyMetadata()

void Instruction::copyMetadata ( const Instruction SrcInst,
ArrayRef< unsigned WL = ArrayRef<unsigned>() 
)

◆ dropDbgRecords()

void Instruction::dropDbgRecords ( )

Erase any DbgRecords attached to this instruction.

Definition at line 318 of file Instruction.cpp.

References DbgMarker, and llvm::DPMarker::dropDbgRecords().

Referenced by llvm::removeAllNonTerminatorAndEHPadInstructions(), and splitCallSite().

◆ dropLocation()

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 964 of file DebugInfo.cpp.

References DL, llvm::MDNode::get(), llvm::Value::getContext(), getDebugLoc(), getFunction(), llvm::Function::getSubprogram(), llvm::IntrinsicInst::mayLowerToFunctionCall(), and setDebugLoc().

Referenced by updateLocationAfterHoist().

◆ dropOneDbgRecord()

void Instruction::dropOneDbgRecord ( DbgRecord I)

Erase a single DbgRecord I that is attached to this instruction.

Definition at line 323 of file Instruction.cpp.

References DbgMarker, and llvm::DPMarker::dropOneDbgRecord().

◆ dropPoisonGeneratingFlags()

void Instruction::dropPoisonGeneratingFlags ( )

Drops flags that may cause this instruction to evaluate to poison despite having non-poison inputs.

Definition at line 406 of file Instruction.cpp.

References assert(), getOpcode(), hasPoisonGeneratingFlags(), setHasNoInfs(), setHasNoNaNs(), and setNonNeg().

Referenced by dropPoisonGeneratingFlagsAndMetadata(), foldSelectShuffleWith1Binop(), llvm::patchReplacementInstruction(), and simplifyAssocCastAssoc().

◆ dropPoisonGeneratingFlagsAndMetadata()

void llvm::Instruction::dropPoisonGeneratingFlagsAndMetadata ( )
inline

Drops flags and metadata that may generate poison.

Definition at line 504 of file Instruction.h.

References dropPoisonGeneratingFlags(), and dropPoisonGeneratingMetadata().

Referenced by clearAssumptionsOfUsers().

◆ dropPoisonGeneratingMetadata()

void Instruction::dropPoisonGeneratingMetadata ( )

Drops metadata that may generate poison.

Definition at line 450 of file Instruction.cpp.

References llvm::Value::eraseMetadata().

Referenced by dropPoisonGeneratingFlagsAndMetadata().

◆ dropUBImplyingAttrsAndMetadata()

void Instruction::dropUBImplyingAttrsAndMetadata ( )

Drop any attributes or metadata that can cause immediate undefined behavior.

Retain other attributes/metadata on a best-effort basis. This should be used when speculating instructions.

Definition at line 475 of file Instruction.cpp.

References dropUBImplyingAttrsAndUnknownMetadata().

Referenced by CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), and foldOperationIntoSelectOperand().

◆ dropUBImplyingAttrsAndUnknownMetadata()

void Instruction::dropUBImplyingAttrsAndUnknownMetadata ( ArrayRef< unsigned KnownIDs = {})

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 456 of file Instruction.cpp.

References dropUnknownNonDebugMetadata(), and llvm::AttributeFuncs::getUBImplyingAttributes().

Referenced by dropUBImplyingAttrsAndMetadata().

◆ dropUnknownNonDebugMetadata() [1/4]

void llvm::Instruction::dropUnknownNonDebugMetadata ( )
inline

◆ dropUnknownNonDebugMetadata() [2/4]

void Instruction::dropUnknownNonDebugMetadata ( ArrayRef< unsigned KnownIDs)

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 1587 of file Metadata.cpp.

References llvm::ArrayRef< T >::begin(), llvm::SmallSet< T, N, C >::count(), llvm::ArrayRef< T >::end(), llvm::Value::eraseMetadataIf(), llvm::Value::hasMetadata(), and llvm::SmallSet< T, N, C >::insert().

Referenced by generateReproducer(), and llvm::gvn::AvailableValue::MaterializeAdjustedValue().

◆ dropUnknownNonDebugMetadata() [3/4]

void llvm::Instruction::dropUnknownNonDebugMetadata ( unsigned  ID1)
inline

Definition at line 417 of file Instruction.h.

References dropUnknownNonDebugMetadata().

◆ dropUnknownNonDebugMetadata() [4/4]

void llvm::Instruction::dropUnknownNonDebugMetadata ( unsigned  ID1,
unsigned  ID2 
)
inline

Definition at line 420 of file Instruction.h.

References dropUnknownNonDebugMetadata().

◆ eraseFromParent()

BasicBlock::iterator Instruction::eraseFromParent ( )

This method unlinks 'this' from the containing basic block and deletes it.

Returns
an iterator pointing to the element after the erased one

Definition at line 102 of file Instruction.cpp.

References llvm::iplist_impl< IntrusiveListT, TraitsT >::erase(), llvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >::getIterator(), getParent(), and handleMarkerRemoval().

Referenced by llvm::LanaiInstrInfo::analyzeBranch(), buildClonedLoopBlocks(), BuildSubAggregate(), llvm::changeToCall(), llvm::changeToInvokeAndSplitBasicBlock(), llvm::CloneAndPruneIntoFromInst(), cloneLoopBlocks(), CloneLoopBlocks(), ConnectEpilog(), ConnectProlog(), llvm::ConstantFoldTerminator(), llvm::OpenMPIRBuilder::createAtomicCompare(), llvm::OpenMPIRBuilder::createCopyinClauseBlocks(), createMemMoveLoop(), createMemSetLoop(), llvm::OpenMPIRBuilder::createReductions(), llvm::OpenMPIRBuilder::createTargetInit(), llvm::OpenMPIRBuilder::createTask(), createTblForTrunc(), createTblShuffleForZExt(), llvm::OpenMPIRBuilder::createTeams(), llvm::deleteDeadLoop(), despeculateCountZeros(), DoFlattenLoopPair(), DoLowering(), doPromotion(), llvm::dropDebugUsers(), dropIntrinsicWithUnknownMetadataArgument(), dropTypeTests(), llvm::OpenMPIRBuilder::emitCancelationCheckImpl(), llvm::SITargetLowering::emitExpandAtomicRMW(), llvm::objcarc::BundledRetainClaimRVs::eraseInst(), llvm::objcarc::EraseInstruction(), EraseTerminatorAndDCECond(), expandAnyIntrinsic(), llvm::expandAtomicRMWToCmpXchg(), expandClampIntrinsic(), llvm::expandDivision(), llvm::expandDivisionUpTo32Bits(), llvm::expandDivisionUpTo64Bits(), expandExpIntrinsic(), expandFPToI(), expandIToFP(), expandLerpIntrinsic(), expandRcpIntrinsic(), llvm::expandRemainder(), llvm::expandRemainderUpTo32Bits(), llvm::expandRemainderUpTo64Bits(), expandToSwitch(), llvm::RandomIRBuilder::findOrCreateSource(), findPHIToPartitionLoops(), llvm::FoldReturnIntoUncondBranch(), FoldTwoEntryPHINode(), generateUnsignedDivisionCode(), getStrlenWithNull(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), hostParallelCallback(), injectPendingInvariantConditions(), llvm::InlineFunction(), inlineRetainOrClaimRVCalls(), insertBoundsCheck(), insertSpills(), insertUniqueBackedgeBlock(), llvm::lowerAtomicCmpXchgInst(), llvm::lowerAtomicRMWInst(), lowerAwaitSuspend(), lowerExpectIntrinsic(), LowerFenceInst(), llvm::SITargetLowering::lowerIdempotentRMWIntoFencedLoad(), lowerIntrinsic(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::IntrinsicLowering::LowerToByteSwap(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeCleanupPad(), mergeConditionalStoreToAddress(), llvm::InstDeleterIRStrategy::mutate(), optimizeDivRem(), OptimizeEmptyGlobalCXXDtors(), OptimizeExtractBits(), OptimizeGlobalAddressOfAllocation(), processAbsIntrinsic(), processAnd(), processAShr(), llvm::JumpThreadingPass::processBlock(), llvm::JumpThreadingPass::processBranchOnXOR(), processMinMaxIntrinsic(), processOverflowIntrinsic(), processSDiv(), processSelect(), processSExt(), processSRem(), promoteSingleBlockAlloca(), llvm::OutlinableRegion::reattachCandidate(), ReduceLoopStrength(), llvm::removeAllNonTerminatorAndEHPadInstructions(), llvm::LanaiInstrInfo::removeBranch(), llvm::PHINode::removeIncomingValue(), llvm::PHINode::removeIncomingValueIf(), removeIntrinsicUsers(), removeMarkerCall(), llvm::SCCPSolver::removeNonFeasibleEdges(), RemovePreallocated(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), replaceCalledFunction(), replaceConditionalBranchesOnConstant(), replaceFrameSizeAndAlignment(), replaceOperation(), replacePrepare(), llvm::replaceSignedInst(), replaceSubOverflowUses(), llvm::rewriteLoopExitValues(), rewritePHIs(), rewriteSingleStoreAlloca(), runImpl(), scalarizeMaskedCompressStore(), scalarizeMaskedExpandLoad(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), simplifyOneLoop(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), simplifySuspendPoint(), sinkAndCmp0Expression(), SinkCast(), speculatePHINodeLoads(), splitBeforeCatchSwitch(), llvm::SplitBlockAndInsertSimpleForLoop(), splitCallSite(), llvm::SplitIndirectBrCriticalEdges(), SplitLandingPadPredecessorsImpl(), llvm::splitLoopBound(), stripDebugDeclareImpl(), targetParallelCallback(), TryToMergeLandingPad(), TryToShrinkGlobalToBoolean(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), turnToExplicitForm(), llvm::UnrollAndJamLoop(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchTrivialBranch(), unswitchTrivialSwitch(), llvm::UpgradeARCRuntime(), llvm::UpgradeIntrinsicCall(), llvm::versionCallSite(), llvm::LoopVersioning::versionLoop(), llvm::ObjectSizeOffsetEvaluator::visitPHINode(), and workshareLoopTargetCallback().

◆ eraseMetadataIf()

void Instruction::eraseMetadataIf ( function_ref< bool(unsigned, MDNode *)>  Pred)

Erase all metadata that matches the predicate.

Definition at line 1580 of file Metadata.cpp.

References llvm::Value::eraseMetadataIf(), and llvm::DebugLoc::getAsMDNode().

◆ extractProfTotalWeight()

bool Instruction::extractProfTotalWeight ( uint64_t TotalVal) const

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 1742 of file Metadata.cpp.

References assert(), and getOpcode().

Referenced by llvm::createCallMatchingInvoke().

◆ getAAMetadata()

AAMDNodes Instruction::getAAMetadata ( ) const

◆ getAccessType()

Type * Instruction::getAccessType ( ) const

Return the type this instruction accesses in memory, if any.

Definition at line 991 of file Instruction.cpp.

References getOpcode(), and llvm::Value::getType().

Referenced by getAccessType().

◆ getAllMetadata()

void llvm::Instruction::getAllMetadata ( SmallVectorImpl< std::pair< unsigned, MDNode * > > &  MDs) const
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 376 of file Instruction.h.

References hasMetadata().

Referenced by llvm::SITargetLowering::emitExpandAtomicRMW().

◆ getAllMetadataOtherThanDebugLoc()

void llvm::Instruction::getAllMetadataOtherThanDebugLoc ( SmallVectorImpl< std::pair< unsigned, MDNode * > > &  MDs) const
inline

This does the same thing as getAllMetadata, except that it filters out the debug location.

Definition at line 383 of file Instruction.h.

References llvm::Value::getAllMetadata().

Referenced by copyMetadata(), and llvm::propagateMetadata().

◆ getDbgRecordRange()

iterator_range< simple_ilist< DbgRecord >::iterator > llvm::Instruction::getDbgRecordRange ( ) const
inline

Return a range over the DbgRecords attached to this instruction.

Definition at line 83 of file Instruction.h.

References DbgMarker, and llvm::getDbgRecordRange().

Referenced by getNextNode(), llvm::FastISel::handleDbgInfo(), hasDbgRecords(), performBranchToCommonDestFolding(), and llvm::memtag::StackInfoBuilder::visit().

◆ getDbgReinsertionPosition()

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 260 of file Instruction.cpp.

References llvm::BasicBlock::getNextMarker(), getParent(), and llvm::DPMarker::StoredDbgRecords.

◆ getDebugLoc()

const DebugLoc & llvm::Instruction::getDebugLoc ( ) const
inline

Return the debug location for this node as a DebugLoc.

Definition at line 453 of file Instruction.h.

Referenced by BreakUpSubtract(), buildFrameDebugInfo(), llvm::changeToInvokeAndSplitBasicBlock(), checkIfSupported(), CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), computeCallStackHash(), ConvertShiftToMul(), copyMetadata(), llvm::CallBrInst::Create(), llvm::CallInst::Create(), llvm::InvokeInst::Create(), llvm::createCallMatchingInvoke(), llvm::VPRecipeBuilder::createEdgeMask(), llvm::InnerLoopVectorizer::createInductionResumeValue(), llvm::OpenMPIRBuilder::createTask(), despeculateCountZeros(), diagnoseInvalidFormatString(), dropLocation(), llvm::VPWidenIntOrFpInductionRecipe::execute(), llvm::VPWidenMemoryInstructionRecipe::execute(), llvm::extractProbe(), llvm::extractProbeFromDiscriminator(), fixupDebugInfoPostExtraction(), fixupLineNumbers(), FoldCondBranchOnValueKnownInPredecessorImpl(), llvm::InstCombinerImpl::foldOpIntoPhi(), llvm::ReplayInlineAdvisor::getAdviceImpl(), getAggregate(), getAggregateVariable(), llvm::SampleContextTracker::getCalleeContextSamplesFor(), llvm::SelectionDAGBuilder::getCurDebugLoc(), llvm::getDebugValueLoc(), getOrCreateDebugLoc(), getStableDebugLoc(), HandleByValArgumentInit(), llvm::hoistAllInstructionsInto(), llvm::InlineFunction(), insertNewDbgInst(), LowerNegateToMultiply(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), operandWithNewAddressSpaceOrCreatePoison(), OptimizeExtractBits(), llvm::InstCombinerImpl::PHIArgMergedDebugLoc(), processAShr(), processSDiv(), processSExt(), processSRem(), llvm::SampleContextTracker::promoteMergeContextSamplesTree(), llvm::removeUnwindEdge(), llvm::IRTranslator::runOnMachineFunction(), scalarizeMaskedCompressStore(), scalarizeMaskedExpandLoad(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), llvm::FastISel::selectOperator(), llvm::setProbeDistributionFactor(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), sinkAndCmp0Expression(), SinkCast(), sinkLastInstruction(), SinkShiftAndTruncate(), SplitBlockPredecessorsImpl(), splitCallSite(), llvm::SplitKnownCriticalEdge(), SplitLandingPadPredecessorsImpl(), llvm::JumpThreadingPass::threadEdge(), TryToShrinkGlobalToBoolean(), llvm::JumpThreadingPass::unfoldSelectInstr(), and updateForIncomingValueLocation().

◆ getFastMathFlags()

FastMathFlags Instruction::getFastMathFlags ( ) const

◆ getFunction() [1/2]

Function * llvm::Instruction::getFunction ( )
inline

Definition at line 170 of file Instruction.h.

References getFunction().

◆ getFunction() [2/2]

const Function * Instruction::getFunction ( ) const

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 84 of file Instruction.cpp.

References llvm::BasicBlock::getParent(), and getParent().

Referenced by analyzeLoopUnrollCost(), canSimplifyNullLoadOrGEP(), canTransformToMemCmp(), computeKnownFPClass(), dropLocation(), llvm::expandAtomicRMWToCmpXchg(), llvm::AArch64TargetLowering::fallBackToDAGISel(), fixupDebugInfoPostExtraction(), forwardStoredOnceStore(), llvm::InstCombinerImpl::freezeOtherUses(), llvm::ReplayInlineAdvisor::getAdviceImpl(), getFunction(), llvm::NVPTXTargetLowering::getPrototype(), getRangeForIntrinsic(), llvm::coro::Shape::getRetconResultTypes(), getShape(), HandleByValArgument(), llvm::InlineFunction(), insertLifetimeMarkersSurroundingCall(), insertSpills(), llvm::InstrumentationIRBuilder::InstrumentationIRBuilder(), isKnownNonZeroFromAssume(), isKnownToBeAPowerOfTwo(), IsOperandAMemoryOperand(), llvm::AA::isPotentiallyReachable(), isPotentiallyReachable(), llvm::AA::isValidAtPosition(), llvm::lowerAtomicRMWInst(), llvm::lowerObjectSizeCall(), mergeDIAssignID(), llvm::LoopInfo::movementPreservesLCSSAForm(), llvm::mustSuppressSpeculation(), NegateValue(), optimizeDoubleFP(), promoteArguments(), removeTailCallAttribute(), llvm::coro::salvageDebugInfo(), llvm::SITargetLowering::shouldExpandAtomicRMWInIR(), simplifyFCmpInst(), simplifyInstructionWithOperands(), simplifyNvvmIntrinsic(), llvm::OutlinableRegion::splitCandidate(), tryToOptimizeStoreOfAllocationToGlobal(), llvm::InstCombinerImpl::visitCallInst(), llvm::InstCombinerImpl::visitReturnInst(), llvm::InstCombinerImpl::visitSExt(), llvm::InstCombinerImpl::visitTrunc(), and llvm::InstCombinerImpl::visitZExt().

◆ getInsertionPointAfterDef()

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 336 of file Instruction.cpp.

References assert(), llvm::BasicBlock::end(), llvm::BasicBlock::getFirstInsertionPt(), llvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >::getIterator(), llvm::BasicBlock::getParent(), getParent(), llvm::Value::getType(), and isTerminator().

◆ getMetadata() [1/2]

MDNode * llvm::Instruction::getMetadata ( StringRef  Kind) const
inline

Get the metadata of given kind attached to this Instruction.

If the metadata is not found then return null.

Definition at line 367 of file Instruction.h.

References hasMetadata().

◆ getMetadata() [2/2]

MDNode * llvm::Instruction::getMetadata ( unsigned  KindID) const
inline

Get the metadata of given kind attached to this Instruction.

If the metadata is not found then return null.

Definition at line 358 of file Instruction.h.

References llvm::DebugLoc::getAsMDNode(), and llvm::Value::getMetadata().

Referenced by AddAliasScopeMetadata(), addAnnotationMetadata(), addBasicBlockMetadata(), llvm::LoopVersioning::annotateInstWithNoAlias(), llvm::changeToInvokeAndSplitBasicBlock(), llvm::combineMetadata(), convertMetadataToAssumes(), llvm::DPValue::createLinkedDPVAssign(), llvm::IRBuilderBase::CreateSelect(), llvm::diagnoseDontCall(), emitDbgAssign(), foldCtpop(), foldCttzCtlz(), llvm::InstCombinerImpl::foldPHIArgLoadIntoPHI(), FoldTwoEntryPHINode(), llvm::at::getAssignmentMarkers(), GetBranchWeights(), llvm::at::getDPVAssignmentMarkers(), getFromRangeMetadata(), llvm::BasicBlock::getIrrLoopHeaderWeight(), llvm::Loop::getLoopID(), llvm::MDNode::getMergedProfMetadata(), llvm::ScopedNoAliasAAResult::getModRefInfo(), llvm::TypeBasedAAResult::getModRefInfo(), llvm::getValueProfDataFromInst(), hasMetadata(), hasOnlyUniformBranches(), llvm::DIBuilder::insertDbgAssign(), insertUniqueBackedgeBlock(), llvm::ARMTTIImpl::instCombineIntrinsic(), llvm::intersectAccessGroups(), llvm::CallLowering::lowerCall(), llvm::FastISel::lowerCallTo(), llvm::makeGuardControlFlowExplicit(), mergeDIAssignID(), migrateDebugInfo(), llvm::LoopStructure::parseLoopStructure(), performBranchToCommonDestFolding(), PropagateCallSiteMetadata(), propagateMemProfHelper(), propagateMemProfMetadata(), llvm::propagateMetadata(), shouldFoldCondBranchesToCommonDestination(), SimplifyCondBranchToCondBranch(), SplitBlockPredecessorsImpl(), turnGuardIntoBranch(), unswitchNontrivialInvariants(), and llvm::CallInst::updateProfWeight().

◆ getModule() [1/2]

Module * llvm::Instruction::getModule ( )
inline

Definition at line 160 of file Instruction.h.

References getModule().

◆ getModule() [2/2]

const Module * Instruction::getModule ( ) const

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 80 of file Instruction.cpp.

References llvm::BasicBlock::getModule(), and getParent().

Referenced by addAssumeNonNull(), llvm::addDiffRuntimeChecks(), addMappingsFromTLI(), llvm::addRuntimeChecks(), addVariantDeclaration(), llvm::buildAssumeFromKnowledge(), CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), collectFrameAlloca(), llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl(), createCoroSave(), CreateGCRelocates(), createTblForTrunc(), llvm::LoongArchTargetLowering::emitMaskedAtomicCmpXchgIntrinsic(), llvm::RISCVTargetLowering::emitMaskedAtomicCmpXchgIntrinsic(), llvm::LoongArchTargetLowering::emitMaskedAtomicRMWIntrinsic(), llvm::RISCVTargetLowering::emitMaskedAtomicRMWIntrinsic(), llvm::expandAtomicRMWToCmpXchg(), factorizeMinMaxTree(), llvm::AMDGPULibCalls::fold(), foldCtpop(), foldCttzCtlz(), foldShuffleOfUnaryOps(), llvm::InstCombinerImpl::foldVectorBinop(), llvm::SCEVExpander::generateOverflowCheck(), llvm::MemoryLocation::get(), llvm::memtag::getAllocaSizeInBytes(), llvm::getAllocSize(), getAtomicOpSize(), llvm::DemandedBits::getDemandedBits(), getGEPInductionOperand(), getModule(), llvm::LazyValueInfo::getPredicateAt(), llvm::InstrProfIncrementInst::getStep(), llvm::VFABI::getVectorVariantNames(), inlineRetainOrClaimRVCalls(), llvm::DIBuilder::insertDbgAssign(), insertSpills(), llvm::GCNTTIImpl::instCombineIntrinsic(), instCombineLD1GatherIndex(), instCombineST1ScatterIndex(), instCombineSVEAllActive(), llvm::TargetLibraryInfoImpl::isCallingConvCCompatible(), llvm::isDereferenceableAndAlignedInLoop(), llvm::GCNTTIImpl::isInlineAsmSourceOfDivergence(), isLoadInvariantInLoop(), isSafePHIToSpeculate(), llvm::isSafeToSpeculativelyExecuteWithOpcode(), lookThroughCast(), llvm::AArch64TargetLowering::lowerDeinterleaveIntrinsicToLoad(), llvm::RISCVTargetLowering::lowerDeinterleaveIntrinsicToLoad(), lowerExpectAssume(), lowerFunnelShifts(), llvm::AArch64TargetLowering::lowerInterleavedLoad(), llvm::ARMTargetLowering::lowerInterleavedLoad(), llvm::RISCVTargetLowering::lowerInterleavedLoad(), llvm::AArch64TargetLowering::lowerInterleaveIntrinsicToStore(), llvm::IntrinsicLowering::LowerToByteSwap(), lowerUMulWithOverflow(), migrateDebugInfo(), modifyIntrinsicCall(), NegateValue(), llvm::LibCallSimplifier::optimizeCall(), optimizeDoubleFP(), promoteSingleBlockAlloca(), reassociateMinMaxWithConstantInOperand(), ReplaceCallWith(), replaceUnaryCall(), llvm::GCNTTIImpl::rewriteIntrinsicWithAddressSpace(), rewriteSingleStoreAlloca(), llvm::LoopVectorizationCostModel::setVectorizedCallDecision(), llvm::VFABI::setVectorVariantNames(), shortenAssignment(), simplifyAMDGCNMemoryIntrinsicDemanded(), simplifyNvvmIntrinsic(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), llvm::simplifyRetainedKnowledge(), simplifyTerminatorLeadingToRet(), simplifyX86extrq(), simplifyX86immShift(), simplifyX86insertq(), simplifyX86varShift(), llvm::SplitBlockAndInsertSimpleForLoop(), trackInlinedStores(), tryToReplaceWithGEPBuiltin(), upgradeAbs(), upgradeAVX512MaskToSelect(), llvm::UpgradeIntrinsicCall(), upgradeX86BinaryIntrinsics(), upgradeX86ConcatShift(), upgradeX86MaskedShift(), upgradeX86Rotate(), upgradeX86VPERMT2Intrinsics(), llvm::AMDGPULibCalls::useNative(), valueCoversEntireFragment(), llvm::InstCombinerImpl::visitAllocSite(), llvm::InstCombinerImpl::visitBitCast(), llvm::InstCombinerImpl::visitCallInst(), llvm::InstCombinerImpl::visitFPTrunc(), and visitIVCast().

◆ getNextNonDebugInstruction() [1/2]

Instruction * llvm::Instruction::getNextNonDebugInstruction ( bool  SkipPseudoOp = false)
inline

Definition at line 829 of file Instruction.h.

References getNextNonDebugInstruction().

◆ getNextNonDebugInstruction() [2/2]

const Instruction * Instruction::getNextNonDebugInstruction ( bool  SkipPseudoOp = false) const

Return a pointer to the next non-debug instruction in the same basic block as 'this', or nullptr if no such instruction exists.

Skip any pseudo operations if SkipPseudoOp is true.

Definition at line 1117 of file Instruction.cpp.

References llvm::ilist_node_with_parent< Instruction, BasicBlock, ilist_iterator_bits< true > >::getNextNode(), and I.

Referenced by findStoresToUninstrumentedArgAllocas(), getNextNonDebugInstruction(), getStableDebugLoc(), isPotentiallyReachable(), RemovePreallocated(), rewriteDebugUsers(), llvm::OutlinableRegion::splitCandidate(), llvm::InstCombinerImpl::visitCallInst(), and llvm::InstCombinerImpl::visitFenceInst().

◆ getNumSuccessors()

unsigned Instruction::getNumSuccessors ( ) const

◆ getOpcode()

unsigned llvm::Instruction::getOpcode ( ) const
inline

Returns a member of one of the enums like Instruction::Add.

Definition at line 251 of file Instruction.h.

References llvm::Value::getValueID().

Referenced by llvm::LanaiInstrInfo::analyzeBranch(), canEvaluateShiftedShift(), canPHITrans(), llvm::SCEVExpander::canReuseFlagsFromOriginalIVInc(), checkIfSafeAddSequence(), clone(), llvm::InstCombinerImpl::convertOrOfShiftsToFunnelShift(), llvm::CallBase::Create(), detectPopcountIdiom(), detectShiftUntilZeroIdiom(), doesInTreeUserNeedToExtract(), dropPoisonGeneratingFlags(), expandFPToI(), expandIToFP(), extractProfTotalWeight(), llvm::RISCVTargetLowering::fallBackToDAGISel(), findDemandedEltsBySingleUser(), findIBRPredecessor(), llvm::InstCombinerImpl::foldICmpInstWithConstantNotInt(), llvm::InstCombinerImpl::foldICmpUsingBoolRange(), llvm::InstCombinerImpl::foldMultiplicationOverflowCheck(), llvm::InstCombinerImpl::foldPHIArgBinOpIntoPHI(), llvm::InstCombinerImpl::foldSelectOpOp(), foldShiftIntoShiftInAnotherHandOfAndInICmp(), foldSignedTruncationCheck(), llvm::InstCombinerImpl::foldVariableSignZeroExtensionOfVariableHighBitExtract(), getAccessType(), getFromRangeMetadata(), getHashValueImpl(), llvm::SCEVExpander::getIVIncOperand(), getLoopPhiForCounter(), llvm::CallBase::getNumSubclassExtraOperands(), llvm::CallBase::getNumSubclassExtraOperandsDynamic(), getNumSuccessors(), llvm::UnaryOperator::getOpcode(), llvm::BinaryOperator::getOpcode(), llvm::CastInst::getOpcode(), llvm::CmpInst::getOpcode(), llvm::SelectInst::getOpcode(), getOpcodeName(), llvm::MemoryLocation::getOrNone(), getSuccessor(), hasAtomicLoad(), hasAtomicStore(), hashCallInst(), hasSameSpecialState(), llvm::InlineFunction(), isAlternateInstruction(), isArithmeticShift(), isAssociative(), isAtomic(), isBinaryOp(), isBitwiseLogicOp(), isCast(), isCommutative(), isEHPad(), isEqualImpl(), llvm::AArch64TTIImpl::isExtPartOfAvgExpr(), isFenceLike(), llvm::SystemZTTIImpl::isFoldableLoad(), isFuncletPad(), isHighCostExpansion(), isIdempotent(), isIdenticalToWhenDefined(), isIntDivRem(), isLogicalShift(), isMatchingStore(), isNilpotent(), isPromotedInstructionLegal(), isReturnNonNull(), llvm::isSafeToSpeculativelyExecute(), llvm::isSafeToSpeculativelyExecuteWithOpcode(), isSameOperationAs(), isShift(), isSpecialTerminator(), isTerminator(), isUnaryOp(), isVolatile(), matchExpandedRem(), mayReadFromMemory(), mayThrow(), mayWriteToMemory(), llvm::InstModificationIRStrategy::mutate(), needsFP(), NegateValue(), performBlockTailMerging(), llvm::BasicTTIImplBase< T >::preferToKeepConstantsAttached(), llvm::VPWidenMemoryInstructionRecipe::print(), llvm::JumpThreadingPass::processBlock(), promoteAllocaUserToVector(), llvm::InstCombinerImpl::reassociateShiftAmtsOfTwoSameDirectionShifts(), llvm::refineInstruction(), llvm::LanaiInstrInfo::removeBranch(), llvm::replaceSignedInst(), setSuccessor(), llvm::AArch64TargetLowering::shouldSinkOperands(), llvm::ARMTargetLowering::shouldSinkOperands(), llvm::InstCombinerImpl::simplifyShrShlDemandedBits(), SinkShiftAndTruncate(), llvm::InstCombinerImpl::SliceUpIllegalIntegerPHI(), llvm::VPRecipeBuilder::tryToCreateWidenRecipe(), llvm::InstCombinerImpl::visitCallInst(), llvm::InstCombinerImpl::visitFCmpInst(), and llvm::InstCombinerImpl::visitICmpInst().

◆ getOpcodeName() [1/2]

const char * llvm::Instruction::getOpcodeName ( ) const
inline

◆ getOpcodeName() [2/2]

const char * Instruction::getOpcodeName ( unsigned  Opcode)
static

Definition at line 653 of file Instruction.cpp.

References llvm::Add, llvm::And, llvm::FAdd, llvm::FMul, llvm::Mul, llvm::Or, PHI, Select, and llvm::Xor.

◆ getParent() [1/2]

BasicBlock * llvm::Instruction::getParent ( )
inline

Definition at line 152 of file Instruction.h.

◆ getParent() [2/2]

const BasicBlock * llvm::Instruction::getParent ( ) const
inline

Definition at line 151 of file Instruction.h.

Referenced by addBoundsChecking(), Prefetch::addInstruction(), addNoRecurseAttrsTopDown(), llvm::RecurrenceDescriptor::AddReductionVar(), AddReturnAttributes(), adoptDbgRecords(), allSameBlock(), AreEquivalentPhiNodes(), areInnerLoopLatchPHIsSupported(), areOuterLoopExitPHIsSupported(), areTwoInsertFromSameBuildVector(), BlockIsSimpleEnoughToThreadThrough(), BrPHIToSelect(), buildPartialInvariantUnswitchConditionalBranch(), llvm::PredicateInfoBuilder::buildPredicateInfo(), llvm::calculateClrEHStateNumbers(), calculateCXXStateNumbers(), calculateSEHStateNumbers(), CalculateUnswitchCostMultiplier(), canFoldTermCondOfLoop(), canHoistIVInc(), llvm::AAResults::canInstructionRangeModRef(), CanPropagatePredecessorsForPHIs(), canSinkInstructions(), canSplitCallSite(), canSplitPredecessors(), llvm::changeToCall(), llvm::changeToInvokeAndSplitBasicBlock(), checkAndReplaceCondition(), checkHoistValue(), checkIfSupported(), checkPHIs(), llvm::cloneAndAdaptNoAliasScopes(), llvm::CloneAndPruneIntoFromInst(), cloneDebugInfoFrom(), cloneInstructionInExitBlock(), llvm::computeConstantRange(), llvm::computeKnownBitsFromContext(), computeKnownFPClassFromCond(), computeKnownFPClassFromContext(), llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl(), ConnectEpilog(), llvm::ConvertDebugDeclareToDebugValue(), llvm::DPValue::createLinkedDPVAssign(), llvm::createMemCpyLoopKnownSize(), createMemMoveLoop(), createMemSetLoop(), llvm::OpenMPIRBuilder::createParallel(), createRetPHINode(), llvm::OpenMPIRBuilder::createSections(), createTileStore(), despeculateCountZeros(), diagnoseInvalidFormatString(), llvm::DominatorTree::dominates(), llvm::PostDominatorTree::dominates(), llvm::InstCombinerImpl::dominatesAllUses(), domTreeLevelBefore(), emitDbgAssign(), eraseFromParent(), llvm::ScalarEvolution::evaluatePredicateAt(), llvm::VPPredInstPHIRecipe::execute(), expandAnyIntrinsic(), expandClampIntrinsic(), expandExpIntrinsic(), expandLerpIntrinsic(), expandRcpIntrinsic(), expandToSwitch(), findBestNonTrivialUnswitchCandidate(), llvm::findDevirtualizableCallsForTypeTest(), findExtractedOutputToOverallOutputMapping(), findInitTrampolineFromBB(), llvm::SCEVExpander::findInsertPointAfter(), findLiveSetAtInst(), llvm::SelectionDAGBuilder::FindMergedConditions(), llvm::DominatorTree::findNearestCommonDominator(), findPotentialBlockers(), llvm::InstCombinerImpl::foldBinopWithPhiOperands(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnValueKnownInPredecessorImpl(), foldDependentIVs(), llvm::InstCombinerImpl::foldFreezeIntoRecurrence(), llvm::InstCombinerImpl::foldIntegerTypedPHI(), foldLoadsRecursive(), llvm::InstCombinerImpl::foldOpIntoPhi(), llvm::InstCombinerImpl::foldPHIArgLoadIntoPHI(), llvm::InstCombinerImpl::foldPHIArgOpIntoPHI(), FoldTwoEntryPHINode(), fpModeMatchesGlobalFPAtomicMode(), llvm::CallBase::getCaller(), llvm::LazyValueInfo::getConstant(), llvm::LazyValueInfo::getConstantRange(), getDbgReinsertionPosition(), getDefaultInlineAdvice(), llvm::MemoryDependenceResults::getDependency(), getDomPredecessorCondition(), llvm::IRSimilarity::IRSimilarityCandidate::getEndBB(), getFunction(), getFunctionTypeFromAsyncSuspend(), getGCResultLocality(), getGVNForPHINode(), getInsertionPointAfterDef(), getInsertPointForUses(), llvm::MemoryDependenceResults::getInvariantGroupPointerDependency(), getInvertibleOperands(), getIVIncrement(), getJumpThreadDuplicationCost(), getModule(), llvm::MustBeExecutedContextExplorer::getMustBeExecutedNextInstruction(), llvm::MustBeExecutedContextExplorer::getMustBeExecutedPrevInstruction(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::MemoryDependenceResults::getNonLocalPointerDependency(), llvm::DbgRecord::getParent(), llvm::DPMarker::getParent(), llvm::LazyValueInfo::getPredicateAt(), getRangeForIntrinsic(), llvm::slpvectorizer::BoUpSLP::getSpillCost(), llvm::IRSimilarity::IRSimilarityCandidate::getStartBB(), llvm::memtag::getUntagLocationIfFunctionExit(), llvm::LazyValueInfoImpl::getValueAtUse(), getVarName(), HandleInlinedEHPad(), HandleInlinedLandingPad(), handlePhiDef(), hasCallsBetween(), hashCallInst(), hasOnlyUniformBranches(), llvm::SCEVExpander::hoistIVInc(), hoistLockstepIdenticalDPValues(), llvm::hoistRegion(), hoistValue(), hostParallelCallback(), INITIALIZE_PASS(), llvm::InlineFunction(), inlineRetainOrClaimRVCalls(), insertAfter(), insertBefore(), llvm::DIBuilder::insertDbgAssign(), llvm::DIBuilder::insertDbgValueIntrinsic(), llvm::DIBuilder::insertDeclare(), insertInto(), llvm::DIBuilder::insertLabel(), insertLifetimeMarkersSurroundingCall(), insertNewDbgInst(), insertSpills(), llvm::GCNTTIImpl::instCombineIntrinsic(), Instruction(), llvm::invertCondition(), IsAcceptableTarget(), llvm::Loop::isAuxiliaryInductionVariable(), isBlockInLCSSAForm(), isColdCallSite(), llvm::isControlFlowEquivalent(), llvm::isCriticalEdge(), isEqualImpl(), isFoldableInLoop(), isGuaranteedNotToBeUndefOrPoison(), llvm::SimpleLoopSafetyInfo::isGuaranteedToExecute(), llvm::ICFLoopSafetyInfo::isGuaranteedToExecute(), isIntegerLoopHeaderPHI(), isKnownNonNullFromDominatingCondition(), llvm::ScalarEvolution::isKnownPredicateAt(), isLoadInvariantInLoop(), isLocalAlloca(), isNonEqualPHIs(), isNotUsedOrFoldableInLoop(), isPowerOfTwoRecurrence(), isPredicatedOnPHI(), llvm::isReachedBefore(), isSafePHIToSpeculate(), llvm::SCEVExpander::isSafeToExpandAt(), llvm::isSafeToLoadUnconditionally(), isSafeToSinkLoad(), isSameUnderlyingObjectInLoop(), llvm::AllocaInst::isStaticAlloca(), llvm::isValidAssumeForContext(), llvm::AA::isValidAtPosition(), isValidCandidateForColdCC(), liesBetween(), llvm::SelectionDAGBuilder::LowerAsSTATEPOINT(), llvm::SelectionDAGBuilder::LowerCallTo(), llvm::makeGuardControlFlowExplicit(), llvm::Loop::makeLoopInvariant(), matchAddReduction(), llvm::SITargetLowering::mayBeEmittedAsTailCall(), MayContainThrowingOrExitingCallAfterCB(), memoryIsNotModifiedBetween(), mergeCleanupPad(), MergeCompatibleInvokesImpl(), mergeConditionalStores(), mergeConditionalStoreToAddress(), moveAfter(), moveAfterPreserving(), moveBBContents(), moveBefore(), moveBeforePreserving(), llvm::LoopInfo::movementPreservesLCSSAForm(), llvm::InstDeleterIRStrategy::mutate(), NegateValue(), nextIRInstructionDataMatchesNextInst(), optimizeBranch(), OptimizeExtractBits(), optimizeSQRT(), performBranchToCommonDestFolding(), llvm::JumpThreadingPass::processBlock(), llvm::JumpThreadingPass::processBranchOnPHI(), llvm::JumpThreadingPass::processBranchOnXOR(), processUse(), llvm::promoteLoopAccessesToScalars(), llvm::AssumptionCache::registerAssumption(), rematerializeLiveValuesAtUses(), removeEmptyCleanup(), removeFromParent(), llvm::InstructionPrecedenceTracking::removeInstruction(), llvm::DPMarker::removeMarker(), removeTriviallyEmptyRange(), replaceArgumentUses(), replaceAsyncResumeFunction(), ReplaceCallWith(), replaceConditionalBranchesOnConstant(), replaceExtractElements(), replaceSubOverflowUses(), returnEdge(), reuseTableCompare(), rewriteDebugUsers(), llvm::GCNTTIImpl::rewriteIntrinsicWithAddressSpace(), llvm::rewriteLoopExitValues(), rewriteSingleStoreAlloca(), RewriteUsesOfClonedInstructions(), llvm::LoopConstrainer::run(), llvm::InstCombinerImpl::run(), llvm::SyntheticCountsPropagation::run(), llvm::PlaceSafepointsPass::runImpl(), runImpl(), safeCxtI(), SafeToMergeTerminators(), scalarizeMaskedCompressStore(), scalarizeMaskedExpandLoad(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), scanPHIsAndUpdateValueMap(), llvm::IRSimilarity::IRInstructionData::setBranchSuccessors(), llvm::IRSimilarity::IRInstructionData::setPHIPredecessors(), llvm::setProfMetadata(), shouldFoldCondBranchesToCommonDestination(), llvm::AArch64TargetLowering::shouldSinkOperands(), shouldSplitOnPHIPredicatedArgument(), shouldSplitOnPredicatedArgument(), SimplifyCondBranchToCondBranch(), simplifyInstructionWithPHI(), simplifyOneLoop(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), simplifyRelocatesOffABase(), simplifySuspendPoint(), llvm::simplifyUsersOfIV(), simplifyUsingControlFlow(), sink(), sinkAndCmp0Expression(), SinkCast(), SinkInstruction(), sinkInstruction(), sinkLifetimeStartMarkers(), llvm::InnerLoopVectorizer::sinkScalarOperands(), SinkShiftAndTruncate(), sinkSpillUsesAfterCoroBegin(), sinkThroughTriviallyReplaceablePHI(), llvm::InstCombinerImpl::SliceUpIllegalIntegerPHI(), splitBeforeCatchSwitch(), llvm::SplitBlockAndInsertSimpleForLoop(), splitCallSite(), llvm::OutlinableRegion::splitCandidate(), llvm::SplitKnownCriticalEdge(), splitPredecessorsOfLoopExit(), targetParallelCallback(), llvm::PHITransAddr::translateValue(), llvm::tryPromoteCall(), llvm::FastISel::tryToFoldLoad(), tryToMoveFreeBeforeNullTest(), llvm::JumpThreadingPass::tryToUnfoldSelect(), tryUnmergingGEPsAcrossIndirectBr(), tryWidenCondBranchToCondBranch(), turnGuardIntoBranch(), turnToExplicitForm(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), updateIDTMetaData(), updateKillStatus(), llvm::CallInst::updateProfWeight(), llvm::JumpThreadingPass::updateSSA(), updateSuccessor(), llvm::UpgradeARCRuntime(), llvm::UpgradeIntrinsicCall(), valueEscapes(), llvm::slpvectorizer::BoUpSLP::vectorizeTree(), llvm::versionCallSite(), llvm::InstCombinerImpl::visitAllocaInst(), llvm::InstCombinerImpl::visitAllocSite(), llvm::InstCombinerImpl::visitBranchInst(), llvm::InstCombinerImpl::visitCallInst(), llvm::ObjectSizeOffsetVisitor::visitLoadInst(), llvm::InstCombinerImpl::visitPHINode(), and workshareLoopTargetCallback().

◆ getPrevNonDebugInstruction() [1/2]

Instruction * llvm::Instruction::getPrevNonDebugInstruction ( bool  SkipPseudoOp = false)
inline

Definition at line 840 of file Instruction.h.

References getPrevNonDebugInstruction().

◆ getPrevNonDebugInstruction() [2/2]

const Instruction * Instruction::getPrevNonDebugInstruction ( bool  SkipPseudoOp = false) const

Return a pointer to the previous non-debug instruction in the same basic block as 'this', or nullptr if no such instruction exists.

Skip any pseudo operations if SkipPseudoOp is true.

Definition at line 1125 of file Instruction.cpp.

References llvm::ilist_node_with_parent< Instruction, BasicBlock, ilist_iterator_bits< true > >::getPrevNode(), and I.

Referenced by getPrevNonDebugInstruction(), InsertStackProtectors(), and llvm::InstCombinerImpl::visitFenceInst().

◆ getStableDebugLoc()

const DebugLoc & Instruction::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.

Definition at line 1132 of file Instruction.cpp.

References getDebugLoc(), and getNextNonDebugInstruction().

◆ getSubclassData()

template<typename BitfieldElement >
BitfieldElement::Type llvm::Instruction::getSubclassData ( ) const
inlineprotected

Definition at line 992 of file Instruction.h.

◆ getSuccessor()

BasicBlock * Instruction::getSuccessor ( unsigned  Idx) const

◆ handleMarkerRemoval()

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 95 of file Instruction.cpp.

References DbgMarker, llvm::BasicBlock::IsNewDbgInfoFormat, and llvm::DPMarker::removeMarker().

Referenced by eraseFromParent(), and removeFromParent().

◆ hasAllowContract()

bool Instruction::hasAllowContract ( ) const

Determine whether the allow-contract flag is set.

Definition at line 569 of file Instruction.cpp.

References assert().

Referenced by llvm::GCNTTIImpl::getArithmeticInstrCost(), and llvm::InstModificationIRStrategy::mutate().

◆ hasAllowReassoc()

bool Instruction::hasAllowReassoc ( ) const

Determine whether the allow-reassociation flag is set.

Definition at line 544 of file Instruction.cpp.

References assert().

Referenced by llvm::InductionDescriptor::getExactFPMathInst(), llvm::InstModificationIRStrategy::mutate(), and llvm::InstCombinerImpl::visitCallInst().

◆ hasAllowReciprocal()

bool Instruction::hasAllowReciprocal ( ) const

Determine whether the allow-reciprocal flag is set.

Definition at line 564 of file Instruction.cpp.

References assert().

Referenced by llvm::InstModificationIRStrategy::mutate().

◆ hasApproxFunc()

bool Instruction::hasApproxFunc ( ) const

Determine whether the approximate-math-functions flag is set.

Definition at line 574 of file Instruction.cpp.

References assert().

Referenced by llvm::GCNTTIImpl::getArithmeticInstrCost(), and llvm::InstModificationIRStrategy::mutate().

◆ hasAtomicLoad()

bool Instruction::hasAtomicLoad ( ) const

Return true if this atomic instruction loads from memory.

Definition at line 937 of file Instruction.cpp.

References assert(), getOpcode(), and isAtomic().

Referenced by llvm::PPCTargetLowering::emitTrailingFence().

◆ hasAtomicStore()

bool Instruction::hasAtomicStore ( ) const

Return true if this atomic instruction stores to memory.

Definition at line 949 of file Instruction.cpp.

References assert(), getOpcode(), and isAtomic().

Referenced by llvm::TargetLoweringBase::emitLeadingFence(), llvm::ARMTargetLowering::emitLeadingFence(), and llvm::VETargetLowering::emitLeadingFence().

◆ hasDbgRecords()

bool Instruction::hasDbgRecords ( ) const

Returns true if any DbgRecords are attached to this instruction.

Definition at line 273 of file Instruction.cpp.

References getDbgRecordRange().

Referenced by getNextNode(), and llvm::FastISel::handleDbgInfo().

◆ hasMetadata() [1/3]

bool llvm::Instruction::hasMetadata ( ) const
inline

◆ hasMetadata() [2/3]

bool llvm::Instruction::hasMetadata ( StringRef  Kind) const
inline

Return true if this instruction has the given type of metadata attached.

Definition at line 352 of file Instruction.h.

References getMetadata().

◆ hasMetadata() [3/3]

bool llvm::Instruction::hasMetadata ( unsigned  KindID) const
inline

Return true if this instruction has the given type of metadata attached.

Definition at line 347 of file Instruction.h.

References getMetadata().

◆ hasMetadataOtherThanDebugLoc()

bool llvm::Instruction::hasMetadataOtherThanDebugLoc ( ) const
inline

Return true if this instruction has metadata attached to it other than a debug location.

Definition at line 344 of file Instruction.h.

References llvm::Value::hasMetadata().

◆ hasNoInfs()

bool Instruction::hasNoInfs ( ) const

Determine whether the no-infs flag is set.

Definition at line 554 of file Instruction.cpp.

References assert().

Referenced by foldFCmpReciprocalAndZero(), and llvm::InstModificationIRStrategy::mutate().

◆ hasNoNaNs()

bool Instruction::hasNoNaNs ( ) const

Determine whether the no-NaNs flag is set.

Definition at line 549 of file Instruction.cpp.

References assert().

Referenced by llvm::InstModificationIRStrategy::mutate().

◆ hasNonNeg()

bool Instruction::hasNonNeg ( ) const

Determine whether the the nneg flag is set.

Definition at line 397 of file Instruction.cpp.

References assert(), llvm::PossiblyNonNegInst::NonNeg, and llvm::Value::SubclassOptionalData.

Referenced by andIRFlags(), processZExt(), llvm::refineInstruction(), and llvm::InstCombinerImpl::visitZExt().

◆ hasNoSignedWrap()

bool Instruction::hasNoSignedWrap ( ) const

◆ hasNoSignedZeros()

bool Instruction::hasNoSignedZeros ( ) const

Determine whether the no-signed-zeros flag is set.

Definition at line 559 of file Instruction.cpp.

References assert().

Referenced by foldSelectBinOpIdentity(), llvm::InstModificationIRStrategy::mutate(), and simplifySelectWithFCmp().

◆ hasNoUnsignedWrap()

bool Instruction::hasNoUnsignedWrap ( ) const

◆ hasPoisonGeneratingFlags()

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 402 of file Instruction.cpp.

Referenced by canFoldTermCondOfLoop(), dropPoisonGeneratingFlags(), and hasPoisonGeneratingFlagsOrMetadata().

◆ hasPoisonGeneratingFlagsOrMetadata()

bool llvm::Instruction::hasPoisonGeneratingFlagsOrMetadata ( ) const
inline

Return true if this instruction has poison-generating flags or metadata.

Definition at line 499 of file Instruction.h.

References hasPoisonGeneratingFlags(), and hasPoisonGeneratingMetadata().

◆ hasPoisonGeneratingMetadata()

bool Instruction::hasPoisonGeneratingMetadata ( ) const

Return true if this instruction has poison-generating metadata.

Definition at line 444 of file Instruction.cpp.

References hasMetadata().

Referenced by hasPoisonGeneratingFlagsOrMetadata().

◆ hasSameSpecialState()

bool Instruction::hasSameSpecialState ( const Instruction I2,
bool  IgnoreAlignment = 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).

Returns
true if the specific instruction has the same opcde specific characteristics as the current one. Determine if one instruction has the same state as another.

Definition at line 740 of file Instruction.cpp.

References assert(), GEP, and getOpcode().

Referenced by isIdenticalToWhenDefined(), and isSameOperationAs().

◆ insertAfter()

void Instruction::insertAfter ( Instruction InsertPos)

Insert an unlinked instruction into a basic block immediately after the specified instruction.

Definition at line 119 of file Instruction.cpp.

References llvm::ilist_node_impl< OptionsT >::getIterator(), getParent(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::insertAfter().

Referenced by addAssumeNonNull(), llvm::OpenMPIRBuilder::createParallel(), DbgInserterHelper(), optimizeDivRem(), and rewritePHIsForCleanupPad().

◆ insertBefore() [1/3]

void Instruction::insertBefore ( BasicBlock BB,
InstListType::iterator  InsertPos 
)

◆ insertBefore() [2/3]

void Instruction::insertBefore ( InstListType::iterator  InsertPos)

Insert an unlinked instruction into a basic block immediately before the specified instruction.

Definition at line 113 of file Instruction.cpp.

References insertBefore().

◆ insertBefore() [3/3]

void Instruction::insertBefore ( Instruction InsertPos)

Insert an unlinked instruction into a basic block immediately before the specified instruction.

Definition at line 107 of file Instruction.cpp.

References llvm::ilist_node_impl< OptionsT >::getIterator(), and insertBefore().

Referenced by llvm::changeToCall(), llvm::CloneBasicBlock(), cloneInstructionInExitBlock(), CloneLoopBlocks(), ConnectEpilog(), ConnectProlog(), llvm::DPValue::createDebugIntrinsic(), llvm::EpilogueVectorizerEpilogueLoop::createEpilogueVectorizedLoopSkeleton(), llvm::createPHIsForSplitLoopExit(), DbgInserterHelper(), llvm::VPWidenIntOrFpInductionRecipe::execute(), llvm::VPFirstOrderRecurrencePHIRecipe::execute(), llvm::VPReductionPHIRecipe::execute(), llvm::VPCanonicalIVPHIRecipe::execute(), findBasePointer(), findOrCreatePHIInBlock(), llvm::formLCSSAForInstructions(), generateReproducer(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleByValArgument(), INITIALIZE_PASS(), insertBefore(), insertInto(), insertLifetimeMarkersSurroundingCall(), llvm::BPFCoreSharedInfo::insertPassThrough(), insertTrivialPHIs(), moveLCSSAPhis(), movePHIValuesToInsertedBlock(), OptimizeExtractBits(), rematerializeChain(), rewriteMaterializableInstructions(), rewritePHIs(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), SinkCast(), sinkCmpExpression(), sinkInstruction(), SinkShiftAndTruncate(), splitCallSite(), llvm::SplitIndirectBrCriticalEdges(), llvm::StoreInst::StoreInst(), llvm::JumpThreadingPass::threadGuard(), tryToReplaceWithGEPBuiltin(), llvm::UnrollRuntimeLoopRemainder(), and llvm::versionCallSite().

◆ insertInto()

BasicBlock::iterator Instruction::insertInto ( BasicBlock ParentBB,
InstListType::iterator  It 
)

◆ isArithmeticShift()

bool llvm::Instruction::isArithmeticShift ( ) const
inline

Return true if this is an arithmetic shift right.

Definition at line 295 of file Instruction.h.

References getOpcode().

Referenced by llvm::InstCombinerImpl::foldICmpAndShift().

◆ isAssociative() [1/2]

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 1139 of file Instruction.cpp.

References llvm::FAdd, llvm::FMul, getOpcode(), and isAssociative().

Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::InstCombinerImpl::foldVectorBinop(), isAssociative(), and simplifyAssociativeBinOp().

◆ isAssociative() [2/2]

static bool llvm::Instruction::isAssociative ( unsigned  Opcode)
inlinestatic

Definition at line 675 of file Instruction.h.

References llvm::Add, llvm::And, llvm::Mul, llvm::Or, and llvm::Xor.

◆ isAtomic()

bool Instruction::isAtomic ( ) const

Return true if this instruction has an AtomicOrdering of unordered or higher.

Definition at line 922 of file Instruction.cpp.

References getOpcode(), and llvm::NotAtomic.

Referenced by llvm::InstCombinerImpl::foldPHIArgLoadIntoPHI(), hasAtomicLoad(), hasAtomicStore(), llvm::LoadInst::isSimple(), llvm::StoreInst::isSimple(), and llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad().

◆ isBinaryOp() [1/2]

bool llvm::Instruction::isBinaryOp ( ) const
inline

◆ isBinaryOp() [2/2]

static bool llvm::Instruction::isBinaryOp ( unsigned  Opcode)
inlinestatic

Definition at line 276 of file Instruction.h.

◆ isBitwiseLogicOp() [1/2]

bool llvm::Instruction::isBitwiseLogicOp ( ) const
inline

◆ isBitwiseLogicOp() [2/2]

static bool llvm::Instruction::isBitwiseLogicOp ( unsigned  Opcode)
inlinestatic

Determine if the Opcode is and/or/xor.

Definition at line 300 of file Instruction.h.

References llvm::And, llvm::Or, and llvm::Xor.

Referenced by foldBitCastBitwiseLogic(), and simplifyAssocCastAssoc().

◆ isCast() [1/2]

bool llvm::Instruction::isCast ( ) const
inline

◆ isCast() [2/2]

static bool llvm::Instruction::isCast ( unsigned  Opcode)
inlinestatic

Determine if the Opcode is one of the CastInst instructions.

Definition at line 310 of file Instruction.h.

◆ isCommutative() [1/2]

bool Instruction::isCommutative ( ) const

◆ isCommutative() [2/2]

static bool llvm::Instruction::isCommutative ( unsigned  Opcode)
inlinestatic

Definition at line 688 of file Instruction.h.

References llvm::Add, llvm::And, llvm::FAdd, llvm::FMul, llvm::Mul, llvm::Or, and llvm::Xor.

◆ isDebugOrPseudoInst()

bool Instruction::isDebugOrPseudoInst ( ) const

Return true if the instruction is a DbgInfoIntrinsic or PseudoProbeInst.

Definition at line 1112 of file Instruction.cpp.

Referenced by llvm::findAvailablePtrLoadStore(), and ProcessBlock().

◆ isEHPad()

bool llvm::Instruction::isEHPad ( ) const
inline

◆ isExact()

bool Instruction::isExact ( ) const

◆ isFast()

bool Instruction::isFast ( ) const

Determine whether all fast-math-flags are set.

Definition at line 539 of file Instruction.cpp.

References assert().

Referenced by llvm::LibCallSimplifier::optimizeCall(), and llvm::InstCombinerImpl::visitCallInst().

◆ isFenceLike()

bool llvm::Instruction::isFenceLike ( ) const
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 760 of file Instruction.h.

References getOpcode().

◆ isFuncletPad() [1/2]

bool llvm::Instruction::isFuncletPad ( ) const
inline

Definition at line 260 of file Instruction.h.

References getOpcode(), and isFuncletPad().

Referenced by isFuncletPad().

◆ isFuncletPad() [2/2]

static bool llvm::Instruction::isFuncletPad ( unsigned  Opcode)
inlinestatic

Determine if the Opcode is one of the FuncletPadInst instructions.

Definition at line 315 of file Instruction.h.

◆ isIdempotent() [1/2]

bool llvm::Instruction::isIdempotent ( ) const
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 705 of file Instruction.h.

References getOpcode(), and isIdempotent().

Referenced by IncorporateWeight(), and isIdempotent().

◆ isIdempotent() [2/2]

static bool llvm::Instruction::isIdempotent ( unsigned  Opcode)
inlinestatic

Definition at line 706 of file Instruction.h.

References llvm::And, and llvm::Or.

◆ isIdenticalTo()

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 808 of file Instruction.cpp.

References I, isIdenticalToWhenDefined(), and llvm::Value::SubclassOptionalData.

Referenced by TryToMergeLandingPad(), and llvm::InstCombinerImpl::visitFenceInst().

◆ isIdenticalToWhenDefined()

bool Instruction::isIdenticalToWhenDefined ( const Instruction I) 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 813 of file Instruction.cpp.

References llvm::PHINode::block_begin(), llvm::User::getNumOperands(), getOpcode(), llvm::Value::getType(), hasSameSpecialState(), I, llvm::User::op_begin(), and llvm::User::op_end().

Referenced by EliminateDuplicatePHINodesNaiveImpl(), isEqualImpl(), and isIdenticalTo().

◆ isIntDivRem() [1/2]

bool llvm::Instruction::isIntDivRem ( ) const
inline

◆ isIntDivRem() [2/2]

static bool llvm::Instruction::isIntDivRem ( unsigned  Opcode)
inlinestatic

Definition at line 280 of file Instruction.h.

◆ isLaunderOrStripInvariantGroup()

bool Instruction::isLaunderOrStripInvariantGroup ( ) const

Return true if the instruction is a llvm.launder.invariant.group or llvm.strip.invariant.group.

Definition at line 1103 of file Instruction.cpp.

◆ isLifetimeStartOrEnd()

bool Instruction::isLifetimeStartOrEnd ( ) const

Return true if the instruction is a llvm.lifetime.start or llvm.lifetime.end marker.

Definition at line 1095 of file Instruction.cpp.

Referenced by llvm::CodeExtractor::findAllocas(), isIntegerWideningViableForSlice(), isUsedByLifetimeMarker(), isVectorPromotionViableForSlice(), and onlyUsedByLifetimeMarkersOrDroppableInstsHelper().

◆ isLogicalShift()

bool llvm::Instruction::isLogicalShift ( ) const
inline

Return true if this is a logical shift left or a logical shift right.

Definition at line 290 of file Instruction.h.

References getOpcode().

Referenced by canEvaluateShiftedShift(), and canShiftBinOpWithConstantRHS().

◆ isNilpotent() [1/2]

bool llvm::Instruction::isNilpotent ( ) const
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 719 of file Instruction.h.

References getOpcode(), and isNilpotent().

Referenced by IncorporateWeight(), and isNilpotent().

◆ isNilpotent() [2/2]

static bool llvm::Instruction::isNilpotent ( unsigned  Opcode)
inlinestatic

Definition at line 720 of file Instruction.h.

References llvm::Xor.

◆ isOnlyUserOfAnyOperand()

bool Instruction::isOnlyUserOfAnyOperand ( )

It checks if this instruction is the only user of at least one of its operands.

Definition at line 367 of file Instruction.cpp.

References llvm::any_of(), and llvm::User::operands().

◆ isSafeToRemove()

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 1080 of file Instruction.cpp.

References isEHPad(), isTerminator(), and mayHaveSideEffects().

◆ isSameOperationAs()

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.

Returns
true if the specified instruction is the same operation as the current one. Determine if one instruction is the same operation as another.

Definition at line 840 of file Instruction.cpp.

References CompareIgnoringAlignment, CompareUsingScalarTypes, llvm::User::getNumOperands(), getOpcode(), llvm::User::getOperand(), llvm::Value::getType(), hasSameSpecialState(), and I.

Referenced by llvm::InstCombinerImpl::foldSelectOpOp().

◆ isShift() [1/2]

bool llvm::Instruction::isShift ( ) const
inline

◆ isShift() [2/2]

static bool llvm::Instruction::isShift ( unsigned  Opcode)
inlinestatic

Determine if the Opcode is one of the shift instructions.

Definition at line 285 of file Instruction.h.

◆ isSpecialTerminator() [1/2]

bool llvm::Instruction::isSpecialTerminator ( ) const
inline

◆ isSpecialTerminator() [2/2]

static bool llvm::Instruction::isSpecialTerminator ( unsigned  Opcode)
inlinestatic

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 321 of file Instruction.h.

◆ isTerminator() [1/2]

bool llvm::Instruction::isTerminator ( ) const
inline

◆ isTerminator() [2/2]

static bool llvm::Instruction::isTerminator ( unsigned  Opcode)
inlinestatic

Definition at line 269 of file Instruction.h.

◆ isUnaryOp() [1/2]

bool llvm::Instruction::isUnaryOp ( ) const
inline

◆ isUnaryOp() [2/2]

static bool llvm::Instruction::isUnaryOp ( unsigned  Opcode)
inlinestatic

Definition at line 273 of file Instruction.h.

◆ isUsedOutsideOfBlock()

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 864 of file Instruction.cpp.

References llvm::PHINode::getIncomingBlock(), I, and llvm::Value::uses().

Referenced by removeEmptyCleanup().

◆ isVolatile()

bool Instruction::isVolatile ( ) const

Return true if this instruction has a volatile memory access.

Definition at line 961 of file Instruction.cpp.

References getOpcode(), and MI.

Referenced by llvm::expandAtomicMemCpyAsLoop(), llvm::MemoryDependenceResults::getNonLocalPointerDependency(), and llvm::MemoryDependenceResults::getSimplePointerDependencyFrom().

◆ mayHaveSideEffects()

bool Instruction::mayHaveSideEffects ( ) const

Return true if the instruction may have side effects.

Side effects are:

  • Writing to memory.
  • Unwinding.
  • Not returning (e.g. an infinite loop).

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 1076 of file Instruction.cpp.

References mayThrow(), mayWriteToMemory(), and willReturn().

Referenced by canMoveAboveCall(), llvm::deleteDeadLoop(), hasHardUserWithinLoop(), isSafePHIToSpeculate(), isSafeToRemove(), llvm::MergeBlockIntoPredecessor(), and llvm::InstCombinerImpl::visitCallInst().

◆ mayReadFromMemory()

bool Instruction::mayReadFromMemory ( ) const

Return true if this instruction may read memory.

Definition at line 882 of file Instruction.cpp.

References getOpcode().

Referenced by GetLocation(), IsAcceptableTarget(), llvm::Dependence::isAnti(), llvm::Dependence::isFlow(), llvm::Dependence::isInput(), and mayReadOrWriteMemory().

◆ mayReadOrWriteMemory()

bool llvm::Instruction::mayReadOrWriteMemory ( ) const
inline

Return true if this instruction may read or write memory.

Definition at line 731 of file Instruction.h.

References mayReadFromMemory(), and mayWriteToMemory().

Referenced by llvm::AliasSetTracker::addUnknown(), llvm::AliasSet::aliasesUnknownInst(), and llvm::intersectAccessGroups().

◆ mayThrow()

bool Instruction::mayThrow ( bool  IncludePhaseOneUnwind = false) const

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 1049 of file Instruction.cpp.

References canUnwindPastLandingPad(), llvm::BasicBlock::getFirstNonPHI(), and getOpcode().

Referenced by isSafeToMove(), and mayHaveSideEffects().

◆ mayWriteToMemory()

bool Instruction::mayWriteToMemory ( ) const

◆ mergeDIAssignID()

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 933 of file DebugInfo.cpp.

References assert(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorBase< Size_T >::empty(), llvm::SmallVectorTemplateCommon< T, typename >::end(), End, getFunction(), getMetadata(), I, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::at::RAUW(), and setMetadata().

Referenced by llvm::InstCombinerImpl::mergeStoreIntoSuccessor().

◆ moveAfter()

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 185 of file Instruction.cpp.

References llvm::ilist_node_impl< OptionsT >::getIterator(), and getParent().

Referenced by rewriteDebugUsers(), and llvm::slpvectorizer::BoUpSLP::vectorizeTree().

◆ moveAfterPreserving()

void Instruction::moveAfterPreserving ( Instruction MovePos)

◆ moveBefore() [1/2]

void Instruction::moveBefore ( BasicBlock BB,
InstListType::iterator  I 
)

Unlink this instruction and insert into BB before I.

Precondition
I is a valid iterator into BB.

Definition at line 201 of file Instruction.cpp.

References I.

◆ moveBefore() [2/2]

void Instruction::moveBefore ( Instruction MovePos)

◆ moveBeforePreserving() [1/2]

void Instruction::moveBeforePreserving ( BasicBlock BB,
InstListType::iterator  I 
)

(See other overload for moveBeforePreserving).

Definition at line 205 of file Instruction.cpp.

References I.

◆ moveBeforePreserving() [2/2]

void Instruction::moveBeforePreserving ( Instruction 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. This method is currently a no-op placeholder, but it will become meaningful when the "RemoveDIs" project is enabled.

Definition at line 181 of file Instruction.cpp.

References llvm::ilist_node_impl< OptionsT >::getIterator(), and getParent().

Referenced by llvm::MergeBlockIntoPredecessor(), and raiseUserConstantDataAllocasToEntryBlock().

◆ operator=()

Instruction & llvm::Instruction::operator= ( const Instruction )
delete

◆ removeFromParent()

void Instruction::removeFromParent ( )

◆ replaceSuccessorWith()

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 1199 of file Instruction.cpp.

References getNumSuccessors(), getSuccessor(), Idx, and setSuccessor().

Referenced by insertUniqueBackedgeBlock(), and llvm::BasicBlock::splitBasicBlockBefore().

◆ setAAMetadata()

void Instruction::setAAMetadata ( const AAMDNodes N)

◆ setDebugLoc()

void llvm::Instruction::setDebugLoc ( DebugLoc  Loc)
inline

Set the debug location information for this instruction.

Definition at line 450 of file Instruction.h.

Referenced by addBoundsChecking(), applyMergedLocation(), llvm::changeToInvokeAndSplitBasicBlock(), CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), copyMetadata(), llvm::createCallMatchingInvoke(), llvm::DPValue::createDebugIntrinsic(), createFFSIntrinsic(), llvm::InnerLoopVectorizer::createInductionResumeValue(), createPopcntIntrinsic(), llvm::OpenMPIRBuilder::createTask(), llvm::InnerLoopVectorizer::createVectorLoopSkeleton(), dropLocation(), llvm::VPWidenIntOrFpInductionRecipe::execute(), llvm::VPCanonicalIVPHIRecipe::execute(), llvm::VPActiveLaneMaskPHIRecipe::execute(), fixupDebugInfoPostExtraction(), FoldCondBranchOnValueKnownInPredecessorImpl(), llvm::InstCombinerImpl::foldOpIntoPhi(), llvm::formLCSSAForInstructions(), generateReproducer(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleByValArgumentInit(), INITIALIZE_PASS(), llvm::InlineFunction(), insertCall(), insertUniqueBackedgeBlock(), LowerNegateToMultiply(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), OptimizeExtractBits(), performBlockTailMerging(), llvm::InstCombinerImpl::PHIArgMergedDebugLoc(), llvm::JumpThreadingPass::processImpliedCondition(), processSaturatingInst(), llvm::promoteLoopAccessesToScalars(), llvm::removeUnwindEdge(), replaceArgumentUses(), llvm::coro::salvageDebugInfo(), llvm::setProbeDistributionFactor(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), sinkAndCmp0Expression(), SinkCast(), sinkCmpExpression(), SinkShiftAndTruncate(), llvm::BasicBlock::splitBasicBlock(), llvm::BasicBlock::splitBasicBlockBefore(), llvm::SplitBlockAndInsertIfThenElse(), SplitBlockPredecessorsImpl(), splitCallSite(), llvm::SplitKnownCriticalEdge(), SplitLandingPadPredecessorsImpl(), llvm::splitLoopBound(), llvm::JumpThreadingPass::threadEdge(), tryToShorten(), TryToShrinkGlobalToBoolean(), llvm::UnrollRuntimeLoopRemainder(), and updateForIncomingValueLocation().

◆ setFast()

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 489 of file Instruction.cpp.

References assert(), and B.

Referenced by llvm::InstModificationIRStrategy::mutate().

◆ setFastMathFlags()

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 529 of file Instruction.cpp.

References assert().

Referenced by CreateAdd(), CreateMul(), llvm::InstCombinerImpl::foldSelectOpOp(), foldShuffleOfUnaryOps(), llvm::GCNTTIImpl::instCombineIntrinsic(), llvm::InstCombinerImpl::SimplifyAssociativeOrCommutative(), llvm::InstCombinerImpl::visitCallInst(), and llvm::InstCombinerImpl::visitFNeg().

◆ setHasAllowContract()

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 519 of file Instruction.cpp.

References assert(), and B.

Referenced by llvm::InstModificationIRStrategy::mutate().

◆ setHasAllowReassoc()

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 494 of file Instruction.cpp.

References assert(), and B.

Referenced by llvm::InstModificationIRStrategy::mutate().

◆ setHasAllowReciprocal()

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 514 of file Instruction.cpp.

References assert(), and B.

Referenced by llvm::InstModificationIRStrategy::mutate().

◆ setHasApproxFunc()

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 524 of file Instruction.cpp.

References assert(), and B.

Referenced by llvm::InstModificationIRStrategy::mutate().

◆ setHasNoInfs()

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 504 of file Instruction.cpp.

References assert(), and B.

Referenced by dropPoisonGeneratingFlags(), foldFNegIntoConstant(), and llvm::InstModificationIRStrategy::mutate().

◆ setHasNoNaNs()

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 499 of file Instruction.cpp.

References assert(), and B.

Referenced by dropPoisonGeneratingFlags(), and llvm::InstModificationIRStrategy::mutate().

◆ setHasNoSignedWrap()

void Instruction::setHasNoSignedWrap ( bool  b = true)

◆ setHasNoSignedZeros()

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 509 of file Instruction.cpp.

References assert(), and B.

Referenced by foldFNegIntoConstant(), llvm::InstModificationIRStrategy::mutate(), and llvm::InstCombinerImpl::visitFNeg().

◆ setHasNoUnsignedWrap()

void Instruction::setHasNoUnsignedWrap ( bool  b = true)

◆ setIsExact()

void Instruction::setIsExact ( bool  b = true)

◆ setMetadata() [1/2]

void Instruction::setMetadata ( StringRef  Kind,
MDNode Node 
)

Definition at line 1566 of file Metadata.cpp.

References llvm::Value::getContext(), hasMetadata(), and setMetadata().

◆ setMetadata() [2/2]

void Instruction::setMetadata ( unsigned  KindID,
MDNode Node 
)

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 1633 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(), llvm::changeToInvokeAndSplitBasicBlock(), combineStoreToNewValue(), llvm::ConstantFoldTerminator(), copyMetadata(), llvm::copyMetadataForLoad(), llvm::copyNonnullMetadata(), llvm::copyRangeMetadata(), llvm::createCallMatchingInvoke(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemMove(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemSet(), llvm::IRBuilderBase::CreateMemSet(), llvm::IRBuilderBase::CreateMemSetInline(), llvm::IRBuilderBase::CreateMemTransferInst(), llvm::IRBuilderBase::CreatePreserveArrayAccessIndex(), llvm::IRBuilderBase::CreatePreserveStructAccessIndex(), llvm::IRBuilderBase::CreatePreserveUnionAccessIndex(), llvm::SITargetLowering::emitExpandAtomicRMW(), findBasePointer(), foldCtpop(), foldCttzCtlz(), llvm::InstCombinerImpl::foldPHIArgLoadIntoPHI(), handlePhiDef(), insertNewDbgInst(), insertUniqueBackedgeBlock(), llvm::ARMTTIImpl::instCombineIntrinsic(), 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(), swapProfMetadata(), unswitchNontrivialInvariants(), llvm::CallInst::updateProfWeight(), llvm::UpgradeIntrinsicCall(), and ~Instruction().

◆ setNonNeg()

void Instruction::setNonNeg ( bool  b = true)

Set or clear the nneg flag on this instruction, which must be a zext instruction.

Definition at line 383 of file Instruction.cpp.

References assert(), llvm::PossiblyNonNegInst::NonNeg, and llvm::Value::SubclassOptionalData.

Referenced by andIRFlags(), copyIRFlags(), dropPoisonGeneratingFlags(), processZExt(), llvm::refineInstruction(), llvm::replaceSignedInst(), and llvm::InstCombinerImpl::visitZExt().

◆ setNoSanitizeMetadata()

void Instruction::setNoSanitizeMetadata ( )

Sets the nosanitize metadata on this instruction.

Definition at line 1725 of file Metadata.cpp.

References llvm::MDNode::get(), llvm::Value::getContext(), and setMetadata().

◆ setSubclassData()

template<typename BitfieldElement >
void llvm::Instruction::setSubclassData ( typename BitfieldElement::Type  Value)
inlineprotected

Definition at line 1001 of file Instruction.h.

◆ setSuccessor()

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 1187 of file Instruction.cpp.

References getOpcode(), and llvm_unreachable.

Referenced by cloneLoopBlocks(), CloneLoopBlocks(), llvm::createMemCpyLoopKnownSize(), replaceSuccessorWith(), llvm::SplitKnownCriticalEdge(), llvm::JumpThreadingPass::threadEdge(), and llvm::JumpThreadingPass::threadThroughTwoBasicBlocks().

◆ swapProfMetadata()

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 1210 of file Instruction.cpp.

References llvm::MDNode::get(), llvm::getBranchWeightMDNode(), llvm::MDNode::getContext(), llvm::MDNode::getNumOperands(), llvm::MDNode::getOperand(), and setMetadata().

Referenced by llvm::BranchInst::swapSuccessors().

◆ updateLocationAfterHoist()

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 962 of file DebugInfo.cpp.

References dropLocation().

◆ user_back() [1/2]

Instruction * llvm::Instruction::user_back ( )
inline

◆ user_back() [2/2]

const Instruction * llvm::Instruction::user_back ( ) const
inline

Definition at line 149 of file Instruction.h.

References llvm::Value::user_begin().

◆ willReturn()

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 1085 of file Instruction.cpp.

Referenced by isRemovableWrite(), isSafeToMove(), and mayHaveSideEffects().

Friends And Related Function Documentation

◆ BasicBlock

friend class BasicBlock
friend

Various leaf nodes.

Definition at line 973 of file Instruction.h.

◆ SymbolTableListTraits< Instruction, ilist_iterator_bits< true > >

Definition at line 915 of file Instruction.h.

Member Data Documentation

◆ DbgMarker

DPMarker* llvm::Instruction::DbgMarker = 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 63 of file Instruction.h.

Referenced by adoptDbgRecords(), cloneDebugInfoFrom(), dropDbgRecords(), dropOneDbgRecord(), getDbgRecordRange(), handleMarkerRemoval(), insertBefore(), llvm::DPMarker::removeFromParent(), and llvm::DPMarker::removeMarker().


The documentation for this class was generated from the following files: