Go to the documentation of this file.
46 #define DEBUG_TYPE "loop-unroll"
49 "Number of loops unrolled with run-time trip counts");
52 cl::desc(
"Allow runtime unrolling for loops with multiple exits, when "
53 "epilog is generated"));
56 cl::desc(
"Assume the non latch exit block to be predictable"));
89 assert(Latch &&
"Loop must have a latch");
90 BasicBlock *PrologLatch = cast<BasicBlock>(VMap[Latch]);
98 for (
PHINode &PN : Succ->phis()) {
112 NewPN->
addIncoming(PN.getIncomingValueForBlock(NewPreHeader),
119 Value *V = PN.getIncomingValueForBlock(Latch);
133 PN.setIncomingValueForBlock(NewPreHeader, NewPN);
135 PN.addIncoming(NewPN, PrologExit);
145 PrologExitPreds.push_back(PredBB);
148 nullptr, PreserveLCSSA);
156 assert(Count != 0 &&
"nonsensical Count!");
167 nullptr, PreserveLCSSA);
169 B.CreateCondBr(BrLoopExit, OriginalLoopLatchExit, NewPreHeader);
196 assert(Latch &&
"Loop must have a latch");
197 BasicBlock *EpilogLatch = cast<BasicBlock>(VMap[Latch]);
229 assert(PN.hasOneUse() &&
"The phi should have 1 use");
230 PHINode *EpilogPN = cast<PHINode>(PN.use_begin()->getUser());
231 assert(EpilogPN->
getParent() == Exit &&
"EpilogPN should be in Exit block");
236 Value *V = PN.getIncomingValueForBlock(Latch);
246 "EpilogPN should have EpilogPreHeader incoming block");
264 for (
PHINode &PN : Succ->phis()) {
270 NewPN->
addIncoming(PN.getIncomingValueForBlock(NewPreHeader), PreHeader);
272 NewPN->
addIncoming(PN.getIncomingValueForBlock(Latch), Latch);
276 PHINode *VPN = cast<PHINode>(VMap[&PN]);
283 Value *BrLoopExit =
B.CreateIsNotNull(ModVal,
"lcmp.mod");
284 assert(Exit &&
"Loop must have a single exit block only");
290 B.CreateCondBr(BrLoopExit, EpilogPreHeader, Exit);
311 const bool UnrollRemainder,
314 std::vector<BasicBlock *> &NewBlocks,
LoopBlocksDFS &LoopBlocks,
316 StringRef suffix = UseEpilogRemainder ?
"epil" :
"prol";
324 NewLoops[ParentLoop] = ParentLoop;
330 NewBlocks.push_back(NewBB);
348 DT->
addNewBlock(NewBB, cast<BasicBlock>(VMap[IDomBB]));
354 VMap.
erase((*BB)->getTerminator());
358 BasicBlock *FirstLoopBB = cast<BasicBlock>(VMap[Header]);
368 Builder.CreateCondBr(IdxCmp, FirstLoopBB, InsertBot);
378 PHINode *NewPHI = cast<PHINode>(VMap[&*
I]);
381 BasicBlock *NewLatch = cast<BasicBlock>(VMap[Latch]);
389 Loop *NewLoop = NewLoops[L];
390 assert(NewLoop &&
"L should have been cloned");
417 bool UseEpilogRemainder) {
440 if (ExitingBlocks.size() > 2)
444 if (OtherExits.size() == 0)
453 return (OtherExits.size() == 1 &&
455 OtherExits[0]->getTerminatingDeoptimizeCall()));
476 uint64_t BackEdgeWeight = (UnrollFactor - 1) * ExitWeight;
479 auto *RemainderLatchBR = cast<BranchInst>(Latch->
getTerminator());
480 unsigned HeaderIdx = (RemainderLatchBR->getSuccessor(0) == Header ? 0 : 1);
481 MDBuilder MDB(RemainderLatchBR->getContext());
485 RemainderLatchBR->setMetadata(LLVMContext::MD_prof, WeightNode);
494 Value *TripCount,
unsigned Count) {
506 return B.CreateAnd(TripCount, Count - 1,
"xtraiter");
511 Value *ModValTmp =
B.CreateURem(BECount, CountC);
512 Value *ModValAdd =
B.CreateAdd(ModValTmp,
516 return B.CreateURem(ModValAdd, CountC,
"xtraiter");
559 Loop *L,
unsigned Count,
bool AllowExpensiveTripCount,
560 bool UseEpilogRemainder,
bool UnrollRemainder,
bool ForgetAllSCEV,
565 LLVM_DEBUG(UseEpilogRemainder ?
dbgs() <<
"Using epilog remainder.\n"
566 :
dbgs() <<
"Using prolog remainder.\n");
584 <<
"Loop latch not terminated by a conditional branch.\n");
588 unsigned ExitIndex = LatchBR->
getSuccessor(0) == Header ? 1 : 0;
596 <<
"One of the loop latch successors must be the exit block.\n");
612 UseEpilogRemainder)) {
615 <<
"Multiple exit/exiting blocks in loop and multi-exit unrolling not "
631 if (isa<SCEVCouldNotCompute>(BECountSC)) {
636 unsigned BEWidth = cast<IntegerType>(BECountSC->
getType())->getBitWidth();
640 const SCEV *TripCountSC =
642 if (isa<SCEVCouldNotCompute>(TripCountSC)) {
651 if (!AllowExpensiveTripCount &&
654 LLVM_DEBUG(
dbgs() <<
"High cost for expanding trip count scev!\n");
660 if (
Log2_32(Count) > BEWidth) {
663 <<
"Count failed constraint on overflow trip count calculation.\n");
681 if (UseEpilogRemainder) {
688 nullptr, PreserveLCSSA);
695 EpilogPreHeader =
SplitBlock(NewExit, NewExitTerminator, DT, LI);
705 if (LI->getLoopFor(LatchExit) != ParentL) {
706 LI->removeBlock(NewExit);
707 ParentL->addBasicBlockToLoop(NewExit, *LI);
708 LI->removeBlock(EpilogPreHeader);
709 ParentL->addBasicBlockToLoop(EpilogPreHeader, *LI);
715 PrologPreHeader =
SplitEdge(PreHeader, Header, DT, LI);
753 TripCount =
B.CreateFreeze(TripCount);
766 UseEpilogRemainder ?
B.CreateICmpULT(BECount,
769 B.CreateIsNotNull(ModVal,
"lcmp.mod");
770 BasicBlock *RemainderLoop = UseEpilogRemainder ? NewExit : PrologPreHeader;
771 BasicBlock *UnrollingLoop = UseEpilogRemainder ? NewPreHeader : PrologExit;
773 B.CreateCondBr(BranchVal, RemainderLoop, UnrollingLoop);
776 if (UseEpilogRemainder)
792 std::vector<BasicBlock *> NewBlocks;
798 BasicBlock *InsertBot = UseEpilogRemainder ? LatchExit : PrologExit;
799 BasicBlock *InsertTop = UseEpilogRemainder ? EpilogPreHeader : PrologPreHeader;
801 L, ModVal, UseEpilogRemainder, UnrollRemainder, InsertTop, InsertBot,
802 NewPreHeader, NewBlocks, LoopBlocks, VMap, DT, LI);
806 if (remainderLoop && !UnrollRemainder)
811 F->getBasicBlockList(),
812 NewBlocks[0]->getIterator(),
819 for (
auto *
BB : OtherExits) {
824 unsigned oldNumOperands = PN.getNumIncomingValues();
827 for (
unsigned i = 0;
i < oldNumOperands;
i++){
828 auto *PredBB =PN.getIncomingBlock(
i);
837 auto *V = PN.getIncomingValue(
i);
841 PN.addIncoming(V, cast<BasicBlock>(VMap[PredBB]));
844 #if defined(EXPENSIVE_CHECKS) && !defined(NDEBUG)
847 "Breaks the definition of dedicated exits!");
866 for (
auto *DomChild : DomNodeBB->children()) {
867 auto *DomChildBB = DomChild->
getBlock();
869 ChildrenToUpdate.push_back(DomChildBB);
872 for (
auto *
BB : ChildrenToUpdate)
900 if (UseEpilogRemainder) {
904 EpilogPreHeader, NewPreHeader, VMap, DT, LI,
928 ConnectProlog(L, BECount, Count, PrologExit, LatchExit, PreHeader,
929 NewPreHeader, VMap, DT, LI, PreserveLCSSA);
937 #if defined(EXPENSIVE_CHECKS) && !defined(NDEBUG)
945 if (Count == 2 && DT && LI && SE) {
953 remainderLoop =
nullptr;
962 Inst.replaceAllUsesWith(V);
974 assert(ExitBB &&
"required after breaking cond br backedge");
982 if (OtherExits.size() > 0) {
993 if (remainderLoop && UnrollRemainder) {
997 { Count - 1,
false,
false,
999 false, ForgetAllSCEV},
1000 LI, SE, DT, AC,
TTI,
nullptr, PreserveLCSSA);
1004 *ResultLoop = remainderLoop;
1005 NumRuntimeUnrolled++;
static cl::opt< bool > UnrollRuntimeMultiExit("unroll-runtime-multi-exit", cl::init(false), cl::Hidden, cl::desc("Allow runtime unrolling for loops with multiple exits, when " "epilog is generated"))
bool 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 SetInsertPoint(BasicBlock *TheBB)
This specifies that created instructions should be appended to the end of the specified block.
This is an optimization pass for GlobalISel generic memory operations.
NodeT * findNearestCommonDominator(NodeT *A, NodeT *B) const
Find nearest common dominator basic block for basic block A and B.
const Loop * addClonedBlockToLoopInfo(BasicBlock *OriginalBB, BasicBlock *ClonedBB, LoopInfo *LI, NewLoopsMap &NewLoops)
Adds ClonedBB to LoopInfo, creates a new loop for ClonedBB if necessary and adds a mapping from the o...
A parsed version of the target data layout string in and methods for querying it.
InstListType::iterator iterator
Instruction iterators...
const Function * getParent() const
Return the enclosing method, or null if none.
Represents a single loop in the control flow graph.
bool contains(const LoopT *L) const
Return true if the specified loop is contained within in this loop.
This class uses information about analyze scalars to rewrite expressions in canonical form.
bool isGuaranteedNotToBeUndefOrPoison(const Value *V, AssumptionCache *AC=nullptr, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr, unsigned Depth=0)
Return true if this function can prove that V does not have undef bits and is never poison.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
void verify(const DominatorTreeBase< BlockT, false > &DomTree) const
const char *const LLVMLoopUnrollFollowupRemainder
The main scalar evolution driver.
Optional< MDNode * > makeFollowupLoopID(MDNode *OrigLoopID, ArrayRef< StringRef > FollowupAttrs, const char *InheritOptionsAttrsPrefix="", bool AlwaysNew=false)
Create a new loop identifier for a loop created from a loop transformation.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Value * expandCodeFor(const SCEV *SH, Type *Ty, Instruction *I)
Insert code to directly compute the specified SCEV expression into the program.
static bool canProfitablyUnrollMultiExitLoop(Loop *L, SmallVectorImpl< BasicBlock * > &OtherExits, BasicBlock *LatchExit, bool UseEpilogRemainder)
Returns true if we can profitably unroll the multi-exit loop L.
static void ConnectProlog(Loop *L, Value *BECount, unsigned Count, BasicBlock *PrologExit, BasicBlock *OriginalLoopLatchExit, BasicBlock *PreHeader, BasicBlock *NewPreHeader, ValueToValueMapTy &VMap, DominatorTree *DT, LoopInfo *LI, bool PreserveLCSSA)
Connect the unrolling prolog code to the original loop.
const BasicBlock * getSingleSuccessor() const
Return the successor of this block if it has a single successor.
DomTreeNodeBase< NodeT > * getNode(const NodeT *BB) const
getNode - return the (Post)DominatorTree node for the specified basic block.
auto successors(MachineBasicBlock *BB)
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
DomTreeNodeBase * getIDom() const
void setIncomingValue(unsigned i, Value *V)
RPOIterator beginRPO() const
Reverse iterate over the cached postorder blocks.
LLVM Basic Block Representation.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LoopT * getParentLoop() const
Return the parent loop if it exists or nullptr for top level loops.
void RemapInstruction(Instruction *I, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr)
Convert the instruction operands from referencing the current values into those specified by VM.
void setLoopAlreadyUnrolled()
Add llvm.loop.unroll.disable to this loop's loop id metadata.
bool isHighCostExpansion(const SCEV *Expr, Loop *L, unsigned Budget, const TargetTransformInfo *TTI, const Instruction *At)
Return true for expressions that can't be evaluated at runtime within given Budget.
Value * getIncomingValue(unsigned i) const
Return incoming value number x.
iterator begin()
Instruction iterator methods.
MDNode * createBranchWeights(uint32_t TrueWeight, uint32_t FalseWeight)
Return metadata containing two branch weights.
iterator_range< block_iterator > blocks() const
bool replacementPreservesLCSSAForm(Instruction *From, Value *To)
Returns true if replacing From with To everywhere is guaranteed to preserve LCSSA form.
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
ArrayRef< BlockT * > getBlocks() const
Get a list of the basic blocks which make up this loop.
RPOIterator endRPO() const
static cl::opt< bool > UnrollRuntimeOtherExitPredictable("unroll-runtime-other-exit-predictable", cl::init(false), cl::Hidden, cl::desc("Assume the non latch exit block to be predictable"))
void setCondition(Value *V)
iterator_range< const_phi_iterator > phis() const
Returns a range that iterates over the phis in the basic block.
STATISTIC(NumFunctions, "Total number of functions")
auto predecessors(MachineBasicBlock *BB)
void setName(const Twine &Name)
Change the name of the value.
void getExitingBlocks(SmallVectorImpl< BlockT * > &ExitingBlocks) const
Return all blocks inside the loop that have successors outside of the loop.
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
int getNumOccurrences() const
static Constant * get(Type *Ty, uint64_t V, bool IsSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
BasicBlock * 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 predecess...
const Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr if the function does no...
void changeImmediateDominator(DomTreeNodeBase< NodeT > *N, DomTreeNodeBase< NodeT > *NewIDom)
changeImmediateDominator - This method is used to update the dominator tree information when a node's...
BlockT * getExitingBlock() const
If getExitingBlocks would return exactly one block, return that block.
const Instruction * getFirstNonPHI() const
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
bool extractProfMetadata(uint64_t &TrueVal, uint64_t &FalseVal) const
Retrieve the raw weight values of a conditional branch or select.
@ RF_NoModuleLevelChanges
If this flag is set, the remapper knows that only local values within a function (such as an instruct...
@ FullyUnrolled
The loop was fully unrolled into straight-line code.
void breakLoopBackedge(Loop *L, DominatorTree &DT, ScalarEvolution &SE, LoopInfo &LI, MemorySSA *MSSA)
Remove the backedge of the specified loop.
static Value * CreateTripRemainder(IRBuilder<> &B, Value *BECount, Value *TripCount, unsigned Count)
Calculate ModVal = (BECount + 1) % Count on the abstract integer domain accounting for the possibilit...
const char *const LLVMLoopUnrollFollowupAll
std::vector< BasicBlock * >::const_reverse_iterator RPOIterator
Store the result of a depth first search within basic blocks contained by a single loop.
bool isLoopSimplifyForm() const
Return true if the Loop is in the form that the LoopSimplify form transforms loops to,...
BasicBlock * CloneBasicBlock(const BasicBlock *BB, ValueToValueMapTy &VMap, const Twine &NameSuffix="", Function *F=nullptr, ClonedCodeInfo *CodeInfo=nullptr, DebugInfoFinder *DIFinder=nullptr)
Return a copy of the specified basic block, but without embedding the block into a particular functio...
This class represents an analyzed expression in the program.
This is an important base class in LLVM.
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
LoopUnrollResult UnrollLoop(Loop *L, UnrollLoopOptions ULO, LoopInfo *LI, ScalarEvolution *SE, DominatorTree *DT, AssumptionCache *AC, const llvm::TargetTransformInfo *TTI, OptimizationRemarkEmitter *ORE, bool PreserveLCSSA, Loop **RemainderLoop=nullptr)
Unroll the given loop by Count.
Value * CreateICmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="")
void setIncomingBlock(unsigned i, BasicBlock *BB)
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
bool erase(const KeyT &Val)
LoopT * getLoopFor(const BlockT *BB) const
Return the inner most loop that BB lives in.
initializer< Ty > init(const Ty &Val)
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
int getBasicBlockIndex(const BasicBlock *BB) const
Return the first index of the specified basic block in the value list for this PHI.
cl::opt< unsigned > SCEVCheapExpansionBudget
BlockT * getLoopPreheader() const
If there is a preheader for this loop, return it.
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
Value * simplifyInstruction(Instruction *I, const SimplifyQuery &Q, OptimizationRemarkEmitter *ORE=nullptr)
See if we can compute a simplified version of this instruction.
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
Value * CreateAdd(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
void perform(LoopInfo *LI)
Traverse the loop blocks and store the DFS result.
BlockT * getLoopLatch() const
If there is a single latch block for this loop, return it.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
constexpr const T & getValue() const &
void setIncomingValueForBlock(const BasicBlock *BB, Value *V)
Set every incoming value(s) for block BB to V.
static void updateLatchBranchWeightsForRemainderLoop(Loop *OrigLoop, Loop *RemainderLoop, uint64_t UnrollFactor)
void forgetTopmostLoop(const Loop *L)
bool isUnconditional() const
bool UnrollRuntimeLoopRemainder(Loop *L, unsigned Count, bool AllowExpensiveTripCount, bool UseEpilogRemainder, bool UnrollRemainder, bool ForgetAllSCEV, LoopInfo *LI, ScalarEvolution *SE, DominatorTree *DT, AssumptionCache *AC, const TargetTransformInfo *TTI, bool PreserveLCSSA, Loop **ResultLoop=nullptr)
Insert code in the prolog/epilog code when unrolling a loop with a run-time trip-count.
bool 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 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.
StringRef - Represent a constant reference to a string, i.e.
A cache of @llvm.assume calls within a function.
void setSuccessor(unsigned Idx, BasicBlock *BB)
Update the specified successor to point at the provided block.
const SCEV * getConstant(ConstantInt *V)
Type * getType() const
All values are typed, get the type of this value.
self_iterator getIterator()
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
StringRef getName() const
Return a constant reference to the value's name.
void getUniqueNonLatchExitBlocks(SmallVectorImpl< BlockT * > &ExitBlocks) const
Return all unique successor blocks of this loop except successors from Latch block are not considered...
DomTreeNodeBase< NodeT > * addNewBlock(NodeT *BB, NodeT *DomBB)
Add a new node to the dominator tree information.
@ RF_IgnoreMissingLocals
If this flag is set, the remapper ignores missing function-local entries (Argument,...
BasicBlock * 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...
bool formDedicatedExitBlocks(Loop *L, DominatorTree *DT, LoopInfo *LI, MemorySSAUpdater *MSSAU, bool PreserveLCSSA)
Ensure that all exit blocks of the loop are dedicated exits.
void setLoopID(MDNode *LoopID) const
Set the llvm.loop loop id metadata for this loop.
static PHINode * Create(Type *Ty, unsigned NumReservedValues, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructors - NumReservedValues is a hint for the number of incoming edges that this phi node will h...
bool loopHasNoAbnormalExits(const Loop *L)
Return true if the loop has no abnormal exits.
MDNode * getLoopID() const
Return the llvm.loop loop id metadata node for this loop if it is present.
BlockT * getHeader() const
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
const BasicBlock * getParent() const
bool verify(VerificationLevel VL=VerificationLevel::Full) const
verify - checks if the tree is correct.
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Type * getType() const
Return the LLVM type of this SCEV expression.
const SCEV * getAddExpr(SmallVectorImpl< const SCEV * > &Ops, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap, unsigned Depth=0)
Get a canonical add expression, or something simpler if possible.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
ValueT lookup(const KeyT &Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
static Loop * CloneLoopBlocks(Loop *L, Value *NewIter, const bool UseEpilogRemainder, const bool UnrollRemainder, BasicBlock *InsertTop, BasicBlock *InsertBot, BasicBlock *Preheader, std::vector< BasicBlock * > &NewBlocks, LoopBlocksDFS &LoopBlocks, ValueToValueMapTy &VMap, DominatorTree *DT, LoopInfo *LI)
Create a clone of the blocks in a loop and connect them together.
Value * CreateSub(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Conditional or Unconditional Branch instruction.
@ Unmodified
The loop was not modified.
BasicBlock * 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.
static void ConnectEpilog(Loop *L, Value *ModVal, BasicBlock *NewExit, BasicBlock *Exit, BasicBlock *PreHeader, BasicBlock *EpilogPreHeader, BasicBlock *NewPreHeader, ValueToValueMapTy &VMap, DominatorTree *DT, LoopInfo *LI, bool PreserveLCSSA)
Connect the unrolling epilog code to the original loop.
LLVM Value Representation.
const SCEV * getExitCount(const Loop *L, const BasicBlock *ExitingBlock, ExitCountKind Kind=Exact)
Return the number of times the backedge executes before the given exit would be taken; if not exactly...
BasicBlock * getSuccessor(unsigned i) const
reference emplace_back(ArgTypes &&... Args)