LLVM 19.0.0git
Namespaces | Functions | Variables
Local.h File Reference
#include "llvm/ADT/ArrayRef.h"
#include "llvm/IR/Dominators.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Transforms/Utils/SimplifyCFGOptions.h"
#include <cstdint>

Go to the source code of this file.

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 

Functions

bool llvm::ConstantFoldTerminator (BasicBlock *BB, bool DeleteDeadConditions=false, const TargetLibraryInfo *TLI=nullptr, DomTreeUpdater *DTU=nullptr)
 If a terminator instruction is predicated on a constant value, convert it into an unconditional branch to the constant destination.
 
bool llvm::isInstructionTriviallyDead (Instruction *I, const TargetLibraryInfo *TLI=nullptr)
 Return true if the result produced by the instruction is not used, and the instruction will return.
 
bool llvm::wouldInstructionBeTriviallyDead (const Instruction *I, const TargetLibraryInfo *TLI=nullptr)
 Return true if the result produced by the instruction would have no side effects if it was not used.
 
bool llvm::wouldInstructionBeTriviallyDeadOnUnusedPaths (Instruction *I, const TargetLibraryInfo *TLI=nullptr)
 Return true if the result produced by the instruction has no side effects on any paths other than where it is used.
 
bool llvm::RecursivelyDeleteTriviallyDeadInstructions (Value *V, const TargetLibraryInfo *TLI=nullptr, MemorySSAUpdater *MSSAU=nullptr, std::function< void(Value *)> AboutToDeleteCallback=std::function< void(Value *)>())
 If the specified value is a trivially dead instruction, delete it.
 
void llvm::RecursivelyDeleteTriviallyDeadInstructions (SmallVectorImpl< WeakTrackingVH > &DeadInsts, const TargetLibraryInfo *TLI=nullptr, MemorySSAUpdater *MSSAU=nullptr, std::function< void(Value *)> AboutToDeleteCallback=std::function< void(Value *)>())
 Delete all of the instructions in DeadInsts, and all other instructions that deleting these in turn causes to be trivially dead.
 
bool llvm::RecursivelyDeleteTriviallyDeadInstructionsPermissive (SmallVectorImpl< WeakTrackingVH > &DeadInsts, const TargetLibraryInfo *TLI=nullptr, MemorySSAUpdater *MSSAU=nullptr, std::function< void(Value *)> AboutToDeleteCallback=std::function< void(Value *)>())
 Same functionality as RecursivelyDeleteTriviallyDeadInstructions, but allow instructions that are not trivially dead.
 
bool llvm::RecursivelyDeleteDeadPHINode (PHINode *PN, const TargetLibraryInfo *TLI=nullptr, MemorySSAUpdater *MSSAU=nullptr)
 If the specified value is an effectively dead PHI node, due to being a def-use chain of single-use nodes that either forms a cycle or is terminated by a trivially dead instruction, delete it.
 
bool llvm::SimplifyInstructionsInBlock (BasicBlock *BB, const TargetLibraryInfo *TLI=nullptr)
 Scan the specified basic block and try to simplify any instructions in it and recursively delete dead instructions.
 
bool llvm::replaceDbgUsesWithUndef (Instruction *I)
 Replace all the uses of an SSA value in @llvm.dbg intrinsics with undef.
 
void llvm::MergeBasicBlockIntoOnlyPred (BasicBlock *BB, DomTreeUpdater *DTU=nullptr)
 BB is a block with one predecessor and its predecessor is known to have one successor (BB!).
 
bool llvm::TryToSimplifyUncondBranchFromEmptyBlock (BasicBlock *BB, DomTreeUpdater *DTU=nullptr)
 BB is known to contain an unconditional branch, and contains no instructions other than PHI nodes, potential debug intrinsics and the branch.
 
bool llvm::EliminateDuplicatePHINodes (BasicBlock *BB)
 Check for and eliminate duplicate PHI nodes in this block.
 
bool llvm::EliminateDuplicatePHINodes (BasicBlock *BB, SmallPtrSetImpl< PHINode * > &ToRemove)
 Check for and eliminate duplicate PHI nodes in this block.
 
bool llvm::simplifyCFG (BasicBlock *BB, const TargetTransformInfo &TTI, DomTreeUpdater *DTU=nullptr, const SimplifyCFGOptions &Options={}, ArrayRef< WeakVH > LoopHeaders={})
 
bool llvm::FlattenCFG (BasicBlock *BB, AAResults *AA=nullptr)
 This function is used to flatten a CFG.
 
bool llvm::FoldBranchToCommonDest (BranchInst *BI, llvm::DomTreeUpdater *DTU=nullptr, MemorySSAUpdater *MSSAU=nullptr, const TargetTransformInfo *TTI=nullptr, unsigned BonusInstThreshold=1)
 If this basic block is ONLY a setcc and a branch, and if a predecessor branches to us and one of our successors, fold the setcc into the predecessor and use logical operations to pick the right destination.
 
AllocaInstllvm::DemoteRegToStack (Instruction &X, bool VolatileLoads=false, Instruction *AllocaPoint=nullptr)
 This function takes a virtual register computed by an Instruction and replaces it with a slot in the stack frame, allocated via alloca.
 
AllocaInstllvm::DemotePHIToStack (PHINode *P, Instruction *AllocaPoint=nullptr)
 This function takes a virtual register computed by a phi node and replaces it with a slot in the stack frame, allocated via alloca.
 
Align llvm::tryEnforceAlignment (Value *V, Align PrefAlign, const DataLayout &DL)
 If the specified pointer points to an object that we control, try to modify the object's alignment to PrefAlign.
 
Align llvm::getOrEnforceKnownAlignment (Value *V, MaybeAlign PrefAlign, const DataLayout &DL, const Instruction *CxtI=nullptr, AssumptionCache *AC=nullptr, const DominatorTree *DT=nullptr)
 Try to ensure that the alignment of V is at least PrefAlign bytes.
 
Align llvm::getKnownAlignment (Value *V, const DataLayout &DL, const Instruction *CxtI=nullptr, AssumptionCache *AC=nullptr, const DominatorTree *DT=nullptr)
 Try to infer an alignment for the specified pointer.
 
CallInstllvm::createCallMatchingInvoke (InvokeInst *II)
 Create a call that matches the invoke II in terms of arguments, attributes, debug information, etc.
 
CallInstllvm::changeToCall (InvokeInst *II, DomTreeUpdater *DTU=nullptr)
 This function converts the specified invoke into a normal call.
 
void llvm::ConvertDebugDeclareToDebugValue (DbgVariableIntrinsic *DII, StoreInst *SI, DIBuilder &Builder)
 ===------------------------------------------------------------------—===// Dbg Intrinsic utilities
 
void llvm::ConvertDebugDeclareToDebugValue (DPValue *DPV, StoreInst *SI, DIBuilder &Builder)
 
void llvm::ConvertDebugDeclareToDebugValue (DbgVariableIntrinsic *DII, LoadInst *LI, DIBuilder &Builder)
 Inserts a llvm.dbg.value intrinsic before a load of an alloca'd value that has an associated llvm.dbg.declare intrinsic.
 
void llvm::ConvertDebugDeclareToDebugValue (DPValue *DPV, LoadInst *LI, DIBuilder &Builder)
 
void llvm::ConvertDebugDeclareToDebugValue (DbgVariableIntrinsic *DII, PHINode *LI, DIBuilder &Builder)
 Inserts a llvm.dbg.value intrinsic after a phi that has an associated llvm.dbg.declare intrinsic.
 
void llvm::ConvertDebugDeclareToDebugValue (DPValue *DPV, PHINode *LI, DIBuilder &Builder)
 
bool llvm::LowerDbgDeclare (Function &F)
 Lowers llvm.dbg.declare intrinsics into appropriate set of llvm.dbg.value intrinsics.
 
void llvm::insertDebugValuesForPHIs (BasicBlock *BB, SmallVectorImpl< PHINode * > &InsertedPHIs)
 Propagate dbg.value intrinsics through the newly inserted PHIs.
 
bool llvm::replaceDbgDeclare (Value *Address, Value *NewAddress, DIBuilder &Builder, uint8_t DIExprFlags, int Offset)
 Replaces llvm.dbg.declare instruction when the address it describes is replaced with a new value.
 
void llvm::replaceDbgValueForAlloca (AllocaInst *AI, Value *NewAllocaAddress, DIBuilder &Builder, int Offset=0)
 Replaces multiple llvm.dbg.value instructions when the alloca it describes is replaced with a new value.
 
void llvm::salvageDebugInfo (Instruction &I)
 Assuming the instruction I is going to be deleted, attempt to salvage debug users of I by writing the effect of I in a DIExpression.
 
void llvm::salvageDebugInfoForDbgValues (Instruction &I, ArrayRef< DbgVariableIntrinsic * > Insns, ArrayRef< DPValue * > DPInsns)
 Implementation of salvageDebugInfo, applying only to instructions in Insns, rather than all debug users from findDbgUsers( I).
 
Valuellvm::salvageDebugInfoImpl (Instruction &I, uint64_t CurrentLocOps, SmallVectorImpl< uint64_t > &Ops, SmallVectorImpl< Value * > &AdditionalValues)
 
bool llvm::replaceAllDbgUsesWith (Instruction &From, Value &To, Instruction &DomPoint, DominatorTree &DT)
 Point debug users of From to To or salvage them.
 
std::pair< unsigned, unsignedllvm::removeAllNonTerminatorAndEHPadInstructions (BasicBlock *BB)
 Remove all instructions from a basic block other than its terminator and any present EH pad instructions.
 
unsigned llvm::changeToUnreachable (Instruction *I, bool PreserveLCSSA=false, DomTreeUpdater *DTU=nullptr, MemorySSAUpdater *MSSAU=nullptr)
 Insert an unreachable instruction before the specified instruction, making it and the rest of the code in the block dead.
 
BasicBlockllvm::changeToInvokeAndSplitBasicBlock (CallInst *CI, BasicBlock *UnwindEdge, DomTreeUpdater *DTU=nullptr)
 Convert the CallInst to InvokeInst with the specified unwind edge basic block.
 
Instructionllvm::removeUnwindEdge (BasicBlock *BB, DomTreeUpdater *DTU=nullptr)
 Replace 'BB's terminator with one that does not have an unwind successor block.
 
bool llvm::removeUnreachableBlocks (Function &F, DomTreeUpdater *DTU=nullptr, MemorySSAUpdater *MSSAU=nullptr)
 Remove all blocks that can not be reached from the function's entry.
 
void llvm::combineMetadata (Instruction *K, const Instruction *J, ArrayRef< unsigned > KnownIDs, bool DoesKMove)
 Combine the metadata of two instructions so that K can replace J.
 
void llvm::combineMetadataForCSE (Instruction *K, const Instruction *J, bool DoesKMove)
 Combine the metadata of two instructions so that K can replace J.
 
void llvm::copyMetadataForLoad (LoadInst &Dest, const LoadInst &Source)
 Copy the metadata from the source instruction to the destination (the replacement for the source instruction).
 
void llvm::patchReplacementInstruction (Instruction *I, Value *Repl)
 Patch the replacement so that it is not more restrictive than the value being replaced.
 
unsigned llvm::replaceNonLocalUsesWith (Instruction *From, Value *To)
 
unsigned llvm::replaceDominatedUsesWith (Value *From, Value *To, DominatorTree &DT, const BasicBlockEdge &Edge)
 Replace each use of 'From' with 'To' if that use is dominated by the given edge.
 
unsigned llvm::replaceDominatedUsesWith (Value *From, Value *To, DominatorTree &DT, const BasicBlock *BB)
 Replace each use of 'From' with 'To' if that use is dominated by the end of the given BasicBlock.
 
bool llvm::callsGCLeafFunction (const CallBase *Call, const TargetLibraryInfo &TLI)
 Return true if this call calls a gc leaf function.
 
void llvm::copyNonnullMetadata (const LoadInst &OldLI, MDNode *N, LoadInst &NewLI)
 Copy a nonnull metadata node to a new load instruction.
 
void llvm::copyRangeMetadata (const DataLayout &DL, const LoadInst &OldLI, MDNode *N, LoadInst &NewLI)
 Copy a range metadata node to a new load instruction.
 
void llvm::dropDebugUsers (Instruction &I)
 Remove the debug intrinsic instructions for the given instruction.
 
void llvm::hoistAllInstructionsInto (BasicBlock *DomBlock, Instruction *InsertPt, BasicBlock *BB)
 Hoist all of the instructions in the IfBlock to the dominant block DomBlock, by moving its instructions to the insertion point InsertPt.
 
DIExpressionllvm::getExpressionForConstant (DIBuilder &DIB, const Constant &C, Type &Ty)
 Given a constant, create a debug information expression.
 
bool llvm::recognizeBSwapOrBitReverseIdiom (Instruction *I, bool MatchBSwaps, bool MatchBitReversals, SmallVectorImpl< Instruction * > &InsertedInsts)
 Try to match a bswap or bitreverse idiom.
 
void llvm::maybeMarkSanitizerLibraryCallNoBuiltin (CallInst *CI, const TargetLibraryInfo *TLI)
 Given a CallInst, check if it calls a string function known to CodeGen, and mark it with NoBuiltin if so.
 
bool llvm::canReplaceOperandWithVariable (const Instruction *I, unsigned OpIdx)
 Given an instruction, is it legal to set operand OpIdx to a non-constant value?
 
Valuellvm::invertCondition (Value *Condition)
 Invert the given true/false value, possibly reusing an existing copy.
 
bool llvm::inferAttributesFromOthers (Function &F)
 If we can infer one attribute from another on the declaration of a function, explicitly materialize the maximal set in the IR.
 

Variables

cl::opt< boolllvm::RequireAndPreserveDomTree
 This function is used to do simplification of a CFG.