15 #ifndef LLVM_TRANSFORMS_UTILS_BASICBLOCKUTILS_H
16 #define LLVM_TRANSFORMS_UTILS_BASICBLOCKUTILS_H
28 class MemoryDependenceResults;
34 class TargetLibraryInfo;
44 MemoryDependenceResults *MemDep =
nullptr);
55 LoopInfo *LI =
nullptr,
56 MemoryDependenceResults *MemDep =
nullptr);
124 const CriticalEdgeSplittingOptions &Options =
125 CriticalEdgeSplittingOptions());
142 bool MadeChange =
false;
170 const CriticalEdgeSplittingOptions &Options =
171 CriticalEdgeSplittingOptions());
175 DominatorTree *DT =
nullptr, LoopInfo *LI =
nullptr);
182 DominatorTree *DT =
nullptr, LoopInfo *LI =
nullptr);
201 DominatorTree *DT =
nullptr,
202 LoopInfo *LI =
nullptr,
203 bool PreserveLCSSA =
false);
218 ArrayRef<BasicBlock *> Preds,
219 const char *Suffix,
const char *Suffix2,
220 SmallVectorImpl<BasicBlock *> &NewBBs,
221 DominatorTree *DT =
nullptr,
222 LoopInfo *LI =
nullptr,
223 bool PreserveLCSSA =
false);
254 MDNode *BranchWeights =
nullptr,
255 DominatorTree *DT =
nullptr,
256 LoopInfo *LI =
nullptr);
273 TerminatorInst **ThenTerm,
274 TerminatorInst **ElseTerm,
275 MDNode *BranchWeights =
nullptr);
290 #endif // LLVM_TRANSFORMS_UTILS_BASICBLOCKUTILS_H
void ReplaceInstWithInst(BasicBlock::InstListType &BIL, BasicBlock::iterator &BI, Instruction *I)
Replace the instruction specified by BI with the instruction specified by I.
void SplitBlockAndInsertIfThenElse(Value *Cond, Instruction *SplitBefore, TerminatorInst **ThenTerm, TerminatorInst **ElseTerm, MDNode *BranchWeights=nullptr)
SplitBlockAndInsertIfThenElse is similar to SplitBlockAndInsertIfThen, but also creates the ElseBlock...
BasicBlock * SplitBlock(BasicBlock *Old, Instruction *SplitPt, DominatorTree *DT=nullptr, LoopInfo *LI=nullptr)
Split the specified block at the specified instruction - everything before SplitPt stays in Old and e...
void DeleteDeadBlock(BasicBlock *BB)
Delete the specified block, which must have no predecessors.
unsigned SplitAllCriticalEdges(Function &F, const CriticalEdgeSplittingOptions &Options=CriticalEdgeSplittingOptions())
Loop over all of the edges in the CFG, breaking critical edges as they are found. ...
Option class for critical edge splitting.
Function Alias Analysis false
bool DeleteDeadPHIs(BasicBlock *BB, const TargetLibraryInfo *TLI=nullptr)
Examine each PHI in the given block and delete it if it is dead.
void 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 origina...
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
unsigned getNumSuccessors() const
Return the number of successors that this terminator has.
BasicBlock * SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, const CriticalEdgeSplittingOptions &Options=CriticalEdgeSplittingOptions())
If this edge is a critical edge, insert a new node to split the critical edge.
CriticalEdgeSplittingOptions & setMergeIdenticalEdges()
SymbolTableList< Instruction > InstListType
Subclasses of this class are all able to terminate a basic block.
LLVM Basic Block Representation.
BasicBlock * getSuccessor(unsigned idx) const
Return the specified successor.
void SplitLandingPadPredecessors(BasicBlock *OrigBB, ArrayRef< BasicBlock * > Preds, const char *Suffix, const char *Suffix2, SmallVectorImpl< BasicBlock * > &NewBBs, DominatorTree *DT=nullptr, LoopInfo *LI=nullptr, bool PreserveLCSSA=false)
This method transforms the landing pad, OrigBB, by introducing two new basic blocks into the function...
Value * GetIfCondition(BasicBlock *BB, BasicBlock *&IfTrue, BasicBlock *&IfFalse)
Check whether BB is the merge point of a if-region.
TerminatorInst * SplitBlockAndInsertIfThen(Value *Cond, Instruction *SplitBefore, bool Unreachable, MDNode *BranchWeights=nullptr, DominatorTree *DT=nullptr, LoopInfo *LI=nullptr)
Split the containing block at the specified instruction - everything before SplitBefore stays in the ...
CriticalEdgeSplittingOptions & setPreserveLCSSA()
CriticalEdgeSplittingOptions(DominatorTree *DT=nullptr, LoopInfo *LI=nullptr)
void FoldSingleEntryPHINodes(BasicBlock *BB, MemoryDependenceResults *MemDep=nullptr)
We know that BB has one predecessor.
bool MergeBlockIntoPredecessor(BasicBlock *BB, DominatorTree *DT=nullptr, LoopInfo *LI=nullptr, MemoryDependenceResults *MemDep=nullptr)
Attempts to merge a block into its predecessor, if possible.
TerminatorInst * getTerminator()
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
ReturnInst * FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB, BasicBlock *Pred)
This method duplicates the specified return instruction into a predecessor which ends in an unconditi...
BasicBlock * SplitBlockPredecessors(BasicBlock *BB, ArrayRef< BasicBlock * > Preds, const char *Suffix, DominatorTree *DT=nullptr, LoopInfo *LI=nullptr, bool PreserveLCSSA=false)
This method introduces at least one new basic block into the function and moves some of the predecess...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
CriticalEdgeSplittingOptions & setDontDeleteUselessPHIs()
unsigned getSuccessorIndex() const
This is used to interface between code that wants to operate on terminator instructions directly...
BasicBlock * SplitEdge(BasicBlock *From, BasicBlock *To, DominatorTree *DT=nullptr, LoopInfo *LI=nullptr)
Split the edge connecting specified block.
bool DontDeleteUselessPHIs
InstListType::iterator iterator
Instruction iterators...