LLVM  14.0.0git
Classes | Namespaces | Functions
BasicBlockUtils.h File Reference
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/Analysis/DomTreeUpdater.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/InstrTypes.h"
#include <cassert>
Include dependency graph for BasicBlockUtils.h:

Go to the source code of this file.

Classes

struct  llvm::CriticalEdgeSplittingOptions
 Option class for critical edge splitting. More...
 

Namespaces

 llvm
 This file implements support for optimizing divisions by a constant.
 

Functions

void llvm::DetatchDeadBlocks (ArrayRef< BasicBlock * > BBs, SmallVectorImpl< DominatorTree::UpdateType > *Updates, bool KeepOneInputPHIs=false)
 Replace contents of every block in BBs with single unreachable instruction. More...
 
void llvm::DeleteDeadBlock (BasicBlock *BB, DomTreeUpdater *DTU=nullptr, bool KeepOneInputPHIs=false)
 Delete the specified block, which must have no predecessors. More...
 
void llvm::DeleteDeadBlocks (ArrayRef< BasicBlock * > BBs, DomTreeUpdater *DTU=nullptr, bool KeepOneInputPHIs=false)
 Delete the specified blocks from BB. More...
 
bool llvm::EliminateUnreachableBlocks (Function &F, DomTreeUpdater *DTU=nullptr, bool KeepOneInputPHIs=false)
 Delete all basic blocks from F that are not reachable from its entry node. More...
 
bool llvm::FoldSingleEntryPHINodes (BasicBlock *BB, MemoryDependenceResults *MemDep=nullptr)
 We know that BB has one predecessor. More...
 
bool llvm::DeleteDeadPHIs (BasicBlock *BB, const TargetLibraryInfo *TLI=nullptr, MemorySSAUpdater *MSSAU=nullptr)
 Examine each PHI in the given block and delete it if it is dead. More...
 
bool llvm::MergeBlockIntoPredecessor (BasicBlock *BB, DomTreeUpdater *DTU=nullptr, LoopInfo *LI=nullptr, MemorySSAUpdater *MSSAU=nullptr, MemoryDependenceResults *MemDep=nullptr, bool PredecessorWithTwoSuccessors=false)
 Attempts to merge a block into its predecessor, if possible. More...
 
bool llvm::MergeBlockSuccessorsIntoGivenBlocks (SmallPtrSetImpl< BasicBlock * > &MergeBlocks, Loop *L=nullptr, DomTreeUpdater *DTU=nullptr, LoopInfo *LI=nullptr)
 Merge block(s) sucessors, if possible. More...
 
bool llvm::RemoveRedundantDbgInstrs (BasicBlock *BB)
 Try to remove redundant dbg.value instructions from given basic block. More...
 
void llvm::ReplaceInstWithValue (BasicBlock::InstListType &BIL, BasicBlock::iterator &BI, Value *V)
 Replace all uses of an instruction (specified by BI) with a value, then remove and delete the original instruction. More...
 
void llvm::ReplaceInstWithInst (BasicBlock::InstListType &BIL, BasicBlock::iterator &BI, Instruction *I)
 Replace the instruction specified by BI with the instruction specified by I. More...
 
void llvm::ReplaceInstWithInst (Instruction *From, Instruction *To)
 Replace the instruction specified by From with the instruction specified by To. More...
 
void llvm::createPHIsForSplitLoopExit (ArrayRef< BasicBlock * > Preds, BasicBlock *SplitBB, BasicBlock *DestBB)
 When a loop exit edge is split, LCSSA form may require new PHIs in the new exit block. More...
 
BasicBlockllvm::SplitCriticalEdge (Instruction *TI, unsigned SuccNum, const CriticalEdgeSplittingOptions &Options=CriticalEdgeSplittingOptions(), const Twine &BBName="")
 If this edge is a critical edge, insert a new node to split the critical edge. More...
 
BasicBlockllvm::SplitKnownCriticalEdge (Instruction *TI, unsigned SuccNum, const CriticalEdgeSplittingOptions &Options=CriticalEdgeSplittingOptions(), const Twine &BBName="")
 If it is known that an edge is critical, SplitKnownCriticalEdge can be called directly, rather than calling SplitCriticalEdge first. More...
 
BasicBlock * llvm::SplitCriticalEdge (BasicBlock *Src, BasicBlock *Dst, const CriticalEdgeSplittingOptions &Options=CriticalEdgeSplittingOptions())
 If an edge from Src to Dst is critical, split the edge and return true, otherwise return false. More...
 
unsigned llvm::SplitAllCriticalEdges (Function &F, const CriticalEdgeSplittingOptions &Options=CriticalEdgeSplittingOptions())
 Loop over all of the edges in the CFG, breaking critical edges as they are found. More...
 
BasicBlockllvm::SplitEdge (BasicBlock *From, BasicBlock *To, DominatorTree *DT=nullptr, LoopInfo *LI=nullptr, MemorySSAUpdater *MSSAU=nullptr, const Twine &BBName="")
 Split the edge connecting the specified blocks, and return the newly created basic block between From and To. More...
 
void llvm::setUnwindEdgeTo (Instruction *TI, BasicBlock *Succ)
 Sets the unwind edge of an instruction to a particular successor. More...
 
void llvm::updatePhiNodes (BasicBlock *DestBB, BasicBlock *OldPred, BasicBlock *NewPred, PHINode *Until=nullptr)
 Replaces all uses of OldPred with the NewPred block in all PHINodes in a block. More...
 
BasicBlockllvm::ehAwareSplitEdge (BasicBlock *BB, BasicBlock *Succ, LandingPadInst *OriginalPad=nullptr, PHINode *LandingPadReplacement=nullptr, const CriticalEdgeSplittingOptions &Options=CriticalEdgeSplittingOptions(), const Twine &BBName="")
 Split the edge connect the specficed blocks in the case that Succ is an Exception Handling Block. More...
 
BasicBlockllvm::SplitBlock (BasicBlock *Old, Instruction *SplitPt, DominatorTree *DT, LoopInfo *LI=nullptr, MemorySSAUpdater *MSSAU=nullptr, const Twine &BBName="", bool Before=false)
 Split the specified block at the specified instruction. More...
 
BasicBlockllvm::SplitBlock (BasicBlock *Old, Instruction *SplitPt, DomTreeUpdater *DTU=nullptr, LoopInfo *LI=nullptr, MemorySSAUpdater *MSSAU=nullptr, const Twine &BBName="", bool Before=false)
 Split the specified block at the specified instruction. More...
 
BasicBlockllvm::splitBlockBefore (BasicBlock *Old, Instruction *SplitPt, DomTreeUpdater *DTU, LoopInfo *LI, MemorySSAUpdater *MSSAU, const Twine &BBName="")
 Split the specified block at the specified instruction SplitPt. More...
 
BasicBlockllvm::SplitBlockPredecessors (BasicBlock *BB, ArrayRef< BasicBlock * > Preds, const char *Suffix, DominatorTree *DT, LoopInfo *LI=nullptr, MemorySSAUpdater *MSSAU=nullptr, bool PreserveLCSSA=false)
 This method introduces at least one new basic block into the function and moves some of the predecessors of BB to be predecessors of the new block. More...
 
BasicBlockllvm::SplitBlockPredecessors (BasicBlock *BB, ArrayRef< BasicBlock * > Preds, const char *Suffix, DomTreeUpdater *DTU=nullptr, LoopInfo *LI=nullptr, MemorySSAUpdater *MSSAU=nullptr, bool PreserveLCSSA=false)
 This method introduces at least one new basic block into the function and moves some of the predecessors of BB to be predecessors of the new block. More...
 
void llvm::SplitLandingPadPredecessors (BasicBlock *OrigBB, ArrayRef< BasicBlock * > Preds, const char *Suffix, const char *Suffix2, SmallVectorImpl< BasicBlock * > &NewBBs, DominatorTree *DT, LoopInfo *LI=nullptr, MemorySSAUpdater *MSSAU=nullptr, bool PreserveLCSSA=false)
 This method transforms the landing pad, OrigBB, by introducing two new basic blocks into the function. More...
 
void llvm::SplitLandingPadPredecessors (BasicBlock *OrigBB, ArrayRef< BasicBlock * > Preds, const char *Suffix, const char *Suffix2, SmallVectorImpl< BasicBlock * > &NewBBs, DomTreeUpdater *DTU=nullptr, LoopInfo *LI=nullptr, MemorySSAUpdater *MSSAU=nullptr, bool PreserveLCSSA=false)
 This method transforms the landing pad, OrigBB, by introducing two new basic blocks into the function. More...
 
ReturnInstllvm::FoldReturnIntoUncondBranch (ReturnInst *RI, BasicBlock *BB, BasicBlock *Pred, DomTreeUpdater *DTU=nullptr)
 This method duplicates the specified return instruction into a predecessor which ends in an unconditional branch. More...
 
Instructionllvm::SplitBlockAndInsertIfThen (Value *Cond, Instruction *SplitBefore, bool Unreachable, MDNode *BranchWeights, DominatorTree *DT, LoopInfo *LI=nullptr, BasicBlock *ThenBlock=nullptr)
 Split the containing block at the specified instruction - everything before SplitBefore stays in the old basic block, and the rest of the instructions in the BB are moved to a new block. More...
 
Instructionllvm::SplitBlockAndInsertIfThen (Value *Cond, Instruction *SplitBefore, bool Unreachable, MDNode *BranchWeights=nullptr, DomTreeUpdater *DTU=nullptr, LoopInfo *LI=nullptr, BasicBlock *ThenBlock=nullptr)
 Split the containing block at the specified instruction - everything before SplitBefore stays in the old basic block, and the rest of the instructions in the BB are moved to a new block. More...
 
void llvm::SplitBlockAndInsertIfThenElse (Value *Cond, Instruction *SplitBefore, Instruction **ThenTerm, Instruction **ElseTerm, MDNode *BranchWeights=nullptr)
 SplitBlockAndInsertIfThenElse is similar to SplitBlockAndInsertIfThen, but also creates the ElseBlock. More...
 
BranchInstllvm::GetIfCondition (BasicBlock *BB, BasicBlock *&IfTrue, BasicBlock *&IfFalse)
 Check whether BB is the merge point of a if-region. More...
 
bool llvm::SplitIndirectBrCriticalEdges (Function &F, BranchProbabilityInfo *BPI=nullptr, BlockFrequencyInfo *BFI=nullptr)
 
BasicBlock * llvm::CreateControlFlowHub (DomTreeUpdater *DTU, SmallVectorImpl< BasicBlock * > &GuardBlocks, const SetVector< BasicBlock * > &Predecessors, const SetVector< BasicBlock * > &Successors, const StringRef Prefix)
 Given a set of incoming and outgoing blocks, create a "hub" such that every edge from an incoming block InBB to an outgoing block OutBB is now split into two edges, one from InBB to the hub and another from the hub to OutBB. More...