40#define DEBUG_TYPE "loop-rotate"
43 "Number of loops not rotated due to the header size");
45 "Number of instructions hoisted into loop preheader");
47 "Number of instructions cloned into loop preheader");
52 cl::desc(
"Allow loop rotation multiple times in order to reach "
53 "a better latch exit"));
61 const unsigned MaxHeaderSize;
74 LoopRotate(
unsigned MaxHeaderSize,
LoopInfo *LI,
79 : MaxHeaderSize(MaxHeaderSize), LI(LI),
TTI(
TTI), AC(AC), DT(DT), SE(SE),
80 MSSAU(MSSAU), SQ(SQ), RotationOnly(RotationOnly),
81 IsUtilMode(IsUtilMode), PrepareForLTO(PrepareForLTO) {}
82 bool processLoop(
Loop *L);
85 bool rotateLoop(
Loop *L,
bool SimplifiedLatch);
86 bool simplifyLoopLatch(
Loop *L);
93 bool Inserted = VM.
insert({K, V}).second;
109 PN->removeIncomingValue(PN->getBasicBlockIndex(OrigPreheader));
114 for (
I = OrigHeader->
begin();
I != E; ++
I) {
115 Value *OrigHeaderVal = &*
I;
131 SSA.AddAvailableValue(OrigHeader, OrigHeaderVal);
132 SSA.AddAvailableValue(OrigPreheader, OrigPreHeaderVal);
138 Instruction *UserInst = cast<Instruction>(U.getUser());
139 if (!isa<PHINode>(UserInst)) {
144 if (UserBB == OrigHeader)
149 if (UserBB == OrigPreheader) {
150 U = OrigPreHeaderVal;
168 if (UserBB == OrigHeader)
176 if (UserBB == OrigPreheader)
177 NewVal = OrigPreHeaderVal;
178 else if (
SSA.HasValueForBlock(UserBB))
179 NewVal =
SSA.GetValueInMiddleOfBlock(UserBB);
182 DbgValue->replaceVariableLocationOp(OrigHeaderVal, NewVal);
191 if (UserBB == OrigHeader)
199 if (UserBB == OrigPreheader)
200 NewVal = OrigPreHeaderVal;
201 else if (
SSA.HasValueForBlock(UserBB))
202 NewVal =
SSA.GetValueInMiddleOfBlock(UserBB);
205 DVR->replaceVariableLocationOp(OrigHeaderVal, NewVal);
215 BranchInst *BI = dyn_cast<BranchInst>(Header->getTerminator());
218 if (L->contains(HeaderExit))
221 for (
auto &Phi : Header->phis()) {
224 return cast<Instruction>(U)->getParent() != HeaderExit;
240 assert(Latch &&
"need latch");
247 if (L->contains(Exit))
251 if (!Exit->getPostdominatingDeoptimizeCall())
255 L->getUniqueExitBlocks(Exits);
256 if (!Exits.
empty()) {
277 bool HasConditionalPreHeader,
280 if (WeightMD ==
nullptr)
291 if (Weights.
size() != 2)
293 uint32_t OrigLoopExitWeight = Weights[0];
294 uint32_t OrigLoopBackedgeWeight = Weights[1];
297 std::swap(OrigLoopExitWeight, OrigLoopBackedgeWeight);
326 if (OrigLoopExitWeight > 0 && OrigLoopBackedgeWeight > 0) {
328 if (HasConditionalPreHeader) {
330 if (OrigLoopBackedgeWeight >= OrigLoopExitWeight) {
339 if ((OrigLoopBackedgeWeight & HighBit) != 0 ||
340 (OrigLoopExitWeight & HighBit) != 0)
342 OrigLoopBackedgeWeight <<= 1;
343 OrigLoopExitWeight <<= 1;
348 ExitWeight0 = OrigLoopExitWeight - OrigLoopBackedgeWeight;
356 if (OrigLoopExitWeight > OrigLoopBackedgeWeight)
357 OrigLoopBackedgeWeight = OrigLoopExitWeight;
359 assert(OrigLoopExitWeight >= ExitWeight0 &&
"Bad branch weight");
360 ExitWeight1 = OrigLoopExitWeight - ExitWeight0;
361 EnterWeight = ExitWeight1;
362 assert(OrigLoopBackedgeWeight >= EnterWeight &&
"Bad branch weight");
363 LoopBackWeight = OrigLoopBackedgeWeight - EnterWeight;
364 }
else if (OrigLoopExitWeight == 0) {
365 if (OrigLoopBackedgeWeight == 0) {
378 LoopBackWeight = OrigLoopBackedgeWeight;
382 assert(OrigLoopBackedgeWeight == 0 &&
"remaining case is backedge zero");
390 SuccsSwapped ? LoopBackWeight : ExitWeight1,
391 SuccsSwapped ? ExitWeight1 : LoopBackWeight,
394 if (HasConditionalPreHeader) {
395 const uint32_t PreHeaderBIWeights[] = {
396 SuccsSwapped ? EnterWeight : ExitWeight0,
397 SuccsSwapped ? ExitWeight0 : EnterWeight,
416bool LoopRotate::rotateLoop(
Loop *L,
bool SimplifiedLatch) {
418 if (
L->getBlocks().size() == 1)
421 bool Rotated =
false;
433 if (!
L->isLoopExiting(OrigHeader))
443 if (
L->isLoopExiting(OrigLatch) && !SimplifiedLatch && IsUtilMode ==
false &&
455 Metrics.analyzeBasicBlock(OrigHeader, *
TTI, EphValues, PrepareForLTO);
458 dbgs() <<
"LoopRotation: NOT rotating - contains non-duplicatable"
459 <<
" instructions: ";
463 if (
Metrics.Convergence != ConvergenceKind::None) {
464 LLVM_DEBUG(
dbgs() <<
"LoopRotation: NOT rotating - contains convergent "
469 if (!
Metrics.NumInsts.isValid()) {
470 LLVM_DEBUG(
dbgs() <<
"LoopRotation: NOT rotating - contains instructions"
471 " with invalid cost: ";
475 if (
Metrics.NumInsts > MaxHeaderSize) {
478 <<
" instructions, which is more than the threshold ("
479 << MaxHeaderSize <<
" instructions): ";
481 ++NumNotRotatedDueToHeaderSize;
487 if (PrepareForLTO &&
Metrics.NumInlineCandidates > 0)
496 if (!OrigPreheader || !
L->hasDedicatedExits())
505 SE->forgetTopmostLoop(L);
510 SE->forgetBlockAndLoopDispositions();
515 MSSAU->getMemorySSA()->verifyMemorySSA();
522 bool BISuccsSwapped =
L->contains(Exit);
525 assert(NewHeader &&
"Unable to determine new loop header");
526 assert(
L->contains(NewHeader) && !
L->contains(Exit) &&
527 "Unable to determine loop header and exit blocks");
532 "New header doesn't have one pred!");
542 for (;
PHINode *PN = dyn_cast<PHINode>(
I); ++
I)
552 using DbgIntrinsicHash =
553 std::pair<std::pair<hash_code, DILocalVariable *>,
DIExpression *>;
554 auto makeHash = [](
auto *
D) -> DbgIntrinsicHash {
555 auto VarLocOps =
D->location_ops();
563 if (
auto *DII = dyn_cast<DbgVariableIntrinsic>(&
I)) {
564 DbgIntrinsics.
insert(makeHash(DII));
570 DbgIntrinsics.
insert(makeHash(&DVR));
580 DbgIntrinsics.
insert(makeHash(&DVR));
587 if (
auto *Decl = dyn_cast<NoAliasScopeDeclInst>(&
I))
590 Module *
M = OrigHeader->getModule();
627 !isa<DbgInfoIntrinsic>(Inst) && !isa<AllocaInst>(Inst) &&
638 if (LoopEntryBranch->
getParent()->IsNewDbgInfoFormat &&
639 !NextDbgInsts.
empty()) {
647 if (DbgIntrinsics.
count(makeHash(&DVR)))
648 DVR.eraseFromParent();
651 NextDbgInsts =
I->getDbgRecordRange();
661 C->insertBefore(LoopEntryBranch);
663 ++NumInstrsDuplicated;
665 if (LoopEntryBranch->
getParent()->IsNewDbgInfoFormat &&
666 !NextDbgInsts.
empty()) {
667 auto Range =
C->cloneDebugInfoFrom(Inst, NextDbgInsts.
begin());
674 if (DbgIntrinsics.
count(makeHash(&DVR)))
675 DVR.eraseFromParent();
683 if (
auto *DII = dyn_cast<DbgVariableIntrinsic>(
C))
684 if (DbgIntrinsics.
count(makeHash(DII))) {
685 C->eraseFromParent();
693 if (V && LI->replacementPreservesLCSSAForm(
C, V)) {
697 if (!
C->mayHaveSideEffects()) {
698 C->eraseFromParent();
708 if (
auto *
II = dyn_cast<AssumeInst>(
C))
709 AC->registerAssumption(
II);
717 if (!NoAliasDeclInstructions.
empty()) {
743 LLVM_DEBUG(
dbgs() <<
" Cloning llvm.experimental.noalias.scope.decl:"
746 NewNAD->
insertBefore(*NewHeader, NewHeaderInsertionPoint);
756 NoAliasDeclScopes.
push_back(NAD->getScopeList());
770 cast<Instruction>(
ValueMap[*NoAliasDeclInstructions.begin()]);
771 auto *LastInst = &OrigPreheader->
back();
786 PHINode *PN = dyn_cast<PHINode>(BI); ++BI)
799 MSSAU->updateForClonedBlockIntoPred(OrigHeader, OrigPreheader,
812 if (!InsertedPHIs.
empty())
816 L->moveToHeader(NewHeader);
817 assert(
L->getHeader() == NewHeader &&
"Latch block is our new header");
824 Updates.
push_back({DominatorTree::Insert, OrigPreheader,
Exit});
825 Updates.
push_back({DominatorTree::Insert, OrigPreheader, NewHeader});
826 Updates.
push_back({DominatorTree::Delete, OrigPreheader, OrigHeader});
829 MSSAU->applyUpdates(Updates, *DT,
true);
831 MSSAU->getMemorySSA()->verifyMemorySSA();
833 DT->applyUpdates(Updates);
847 const bool HasConditionalPreHeader =
848 !isa<ConstantInt>(
Cond) ||
853 if (HasConditionalPreHeader) {
861 OrigPreheader, NewHeader,
870 bool SplitLatchEdge =
false;
873 Loop *PredLoop = LI->getLoopFor(ExitPred);
874 if (!PredLoop || PredLoop->
contains(Exit) ||
875 isa<IndirectBrInst>(ExitPred->getTerminator()))
877 SplitLatchEdge |=
L->getLoopLatch() == ExitPred;
884 "Despite splitting all preds, failed to split latch exit?");
885 (void)SplitLatchEdge;
889 Exit->removePredecessor(OrigPreheader,
true );
895 if (DT) DT->deleteEdge(OrigPreheader, Exit);
899 MSSAU->removeEdge(OrigPreheader, Exit);
902 assert(
L->getLoopPreheader() &&
"Invalid loop preheader after loop rotation");
903 assert(
L->getLoopLatch() &&
"Invalid loop latch after loop rotation");
906 MSSAU->getMemorySSA()->verifyMemorySSA();
919 MSSAU->getMemorySSA()->verifyMemorySSA();
926 SimplifiedLatch =
false;
944 bool seenIncrement =
false;
945 bool MultiExitLoop =
false;
947 if (!L->getExitingBlock())
948 MultiExitLoop =
true;
955 if (isa<DbgInfoIntrinsic>(
I))
958 switch (
I->getOpcode()) {
961 case Instruction::GetElementPtr:
963 if (!cast<GEPOperator>(
I)->hasAllConstantIndices())
967 case Instruction::Add:
968 case Instruction::Sub:
969 case Instruction::And:
970 case Instruction::Or:
971 case Instruction::Xor:
972 case Instruction::Shl:
973 case Instruction::LShr:
974 case Instruction::AShr: {
976 !isa<Constant>(
I->getOperand(0))
978 : !isa<Constant>(
I->getOperand(1)) ?
I->getOperand(1) :
nullptr;
986 auto *UserInst = cast<Instruction>(UseI);
987 if (!L->contains(UserInst))
994 seenIncrement =
true;
997 case Instruction::Trunc:
998 case Instruction::ZExt:
999 case Instruction::SExt:
1015bool LoopRotate::simplifyLoopLatch(
Loop *L) {
1025 if (!LastExit || !
L->isLoopExiting(LastExit))
1036 << LastExit->
getName() <<
"\n");
1044 SE->forgetBlockAndLoopDispositions();
1048 MSSAU->getMemorySSA()->verifyMemorySSA();
1054bool LoopRotate::processLoop(
Loop *L) {
1056 MDNode *LoopMD =
L->getLoopID();
1058 bool SimplifiedLatch =
false;
1064 SimplifiedLatch = simplifyLoopLatch(L);
1066 bool MadeChange = rotateLoop(L, SimplifiedLatch);
1067 assert((!MadeChange ||
L->isLoopExiting(
L->getLoopLatch())) &&
1068 "Loop latch should be exiting after loop-rotate.");
1072 if ((MadeChange || SimplifiedLatch) && LoopMD)
1073 L->setLoopID(LoopMD);
1075 return MadeChange || SimplifiedLatch;
1084 unsigned Threshold =
unsigned(-1),
1085 bool IsUtilMode =
true,
bool PrepareForLTO) {
1086 LoopRotate LR(Threshold, LI,
TTI, AC, DT, SE, MSSAU, SQ, RotationOnly,
1087 IsUtilMode, PrepareForLTO);
1088 return LR.processLoop(L);
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
This file provides various utilities for inspecting and working with the control flow graph in LLVM I...
static bool isZero(Value *V, const DataLayout &DL, DominatorTree *DT, AssumptionCache *AC)
static constexpr uint32_t ZeroTripCountWeights[]
static bool canRotateDeoptimizingLatchExit(Loop *L)
static bool shouldSpeculateInstrs(BasicBlock::iterator Begin, BasicBlock::iterator End, Loop *L)
Determine whether the instructions in this range may be safely and cheaply speculated.
static cl::opt< bool > MultiRotate("loop-rotate-multi", cl::init(false), cl::Hidden, cl::desc("Allow loop rotation multiple times in order to reach " "a better latch exit"))
static bool profitableToRotateLoopExitingLatch(Loop *L)
static void updateBranchWeights(BranchInst &PreHeaderBI, BranchInst &LoopBI, bool HasConditionalPreHeader, bool SuccsSwapped)
static void InsertNewValueIntoMap(ValueToValueMapTy &VM, Value *K, Value *V)
Insert (K, V) pair into the ValueToValueMap, and verify the key did not previously exist in the map,...
static void RewriteUsesOfClonedInstructions(BasicBlock *OrigHeader, BasicBlock *OrigPreheader, ValueToValueMapTy &ValueMap, ScalarEvolution *SE, SmallVectorImpl< PHINode * > *InsertedPHIs)
RewriteUsesOfClonedInstructions - We just cloned the instructions from the old header into the prehea...
This file exposes an interface to building/using memory SSA to walk memory instructions using a use/d...
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
uint64_t IntrinsicInst * II
This file contains the declarations for profiling metadata utility functions.
const SmallVectorImpl< MachineOperand > & Cond
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
Class recording the (high level) value of a variable.
A cache of @llvm.assume calls within a function.
LLVM Basic Block Representation.
iterator begin()
Instruction iterator methods.
bool hasAddressTaken() const
Returns true if there are any uses of this basic block other than direct branches,...
InstListType::const_iterator getFirstNonPHIIt() const
Iterator returning form of getFirstNonPHI.
const BasicBlock * getSinglePredecessor() const
Return the predecessor of this block if it has a single predecessor block.
const BasicBlock * getUniquePredecessor() const
Return the predecessor of this block if it has a unique predecessor block.
void flushTerminatorDbgRecords()
Eject any debug-info trailing at the end of a block.
DbgMarker * getMarker(InstListType::iterator It)
Return the DbgMarker for the position given by It, so that DbgRecords can be inserted there.
InstListType::iterator iterator
Instruction iterators...
LLVMContext & getContext() const
Get the context in which this basic block lives.
void moveBefore(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it into the function that MovePos lives ...
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 CallInst * getPostdominatingDeoptimizeCall() const
Returns the call instruction calling @llvm.experimental.deoptimize that is present either in current ...
const Instruction & back() const
Conditional or Unconditional Branch instruction.
bool isConditional() const
static BranchInst * Create(BasicBlock *IfTrue, InsertPosition InsertBefore=nullptr)
BasicBlock * getSuccessor(unsigned i) const
bool isUnconditional() const
Value * getCondition() const
static iterator_range< simple_ilist< DbgRecord >::iterator > getEmptyDbgRecordRange()
const BasicBlock * getParent() const
Record of a variable value-assignment, aka a non instruction representation of the dbg....
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
bool isPresplitCoroutine() const
Determine if the function is presplit coroutine.
Instruction * clone() const
Create a copy of 'this' instruction that is identical in all ways except the following:
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.
bool mayWriteToMemory() const LLVM_READONLY
Return true if this instruction may modify memory.
iterator_range< simple_ilist< DbgRecord >::iterator > getDbgRecordRange() const
Return a range over the DbgRecords attached to this instruction.
void insertBefore(Instruction *InsertPos)
Insert an unlinked instruction into a basic block immediately before the specified instruction.
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
InstListType::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
const Function * getFunction() const
Return the function this instruction belongs to.
bool isTerminator() const
bool mayReadFromMemory() const LLVM_READONLY
Return true if this instruction may read memory.
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
void moveBefore(Instruction *MovePos)
Unlink this instruction from its current basic block and insert it into the basic block that MovePos ...
bool contains(const LoopT *L) const
Return true if the specified loop is contained within in this loop.
Represents a single loop in the control flow graph.
A Module instance is used to store all the information related to an LLVM module.
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
Value * getIncomingValueForBlock(const BasicBlock *BB) const
Helper class for SSA formation on a set of values defined in multiple blocks.
The main scalar evolution driver.
void forgetValue(Value *V)
This method should be called by the client when it has changed a value in a way that may effect its v...
Implements a dense probed hash-table based set with some number of buckets stored inline.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
A Use represents the edge between a Value definition and its users.
ValueT lookup(const KeyT &Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
void setName(const Twine &Name)
Change the name of the value.
iterator_range< user_iterator > users()
iterator_range< use_iterator > uses()
StringRef getName() const
Return a constant reference to the value's name.
void dump() const
Support for debugging, callable in GDB: V->dump()
std::pair< iterator, bool > insert(const ValueT &V)
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
const ParentTy * getParent() const
self_iterator getIterator()
A range adaptor for a pair of iterators.
@ C
The default llvm calling convention, compatible with C.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
bool RemoveRedundantDbgInstrs(BasicBlock *BB)
Try to remove redundant dbg.value instructions from given basic block.
auto successors(const MachineBasicBlock *BB)
MDNode * getBranchWeightMDNode(const Instruction &I)
Get the branch weights metadata node.
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...
void findDbgValues(SmallVectorImpl< DbgValueInst * > &DbgValues, Value *V, SmallVectorImpl< DbgVariableRecord * > *DbgVariableRecords=nullptr)
Finds the llvm.dbg.value intrinsics describing a value.
void insertDebugValuesForPHIs(BasicBlock *BB, SmallVectorImpl< PHINode * > &InsertedPHIs)
Propagate dbg.value intrinsics through the newly inserted PHIs.
Value * simplifyInstruction(Instruction *I, const SimplifyQuery &Q)
See if we can compute a simplified version of this instruction.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
auto reverse(ContainerTy &&C)
void setBranchWeights(Instruction &I, ArrayRef< uint32_t > Weights, bool IsExpected)
Create a new branch_weights metadata node and add or overwrite a prof metadata reference to instructi...
@ RF_IgnoreMissingLocals
If this flag is set, the remapper ignores missing function-local entries (Argument,...
@ RF_NoModuleLevelChanges
If this flag is set, the remapper knows that only local values within a function (such as an instruct...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool isSafeToSpeculativelyExecute(const Instruction *I, const Instruction *CtxI=nullptr, AssumptionCache *AC=nullptr, const DominatorTree *DT=nullptr, const TargetLibraryInfo *TLI=nullptr, bool UseVariableInfo=true)
Return true if the instruction does not have any effects besides calculating the result and does not ...
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 extractFromBranchWeightMD32(const MDNode *ProfileData, SmallVectorImpl< uint32_t > &Weights)
Faster version of extractBranchWeights() that skips checks and must only be called with "branch_weigh...
bool VerifyMemorySSA
Enables verification of MemorySSA.
bool MergeBlockIntoPredecessor(BasicBlock *BB, DomTreeUpdater *DTU=nullptr, LoopInfo *LI=nullptr, MemorySSAUpdater *MSSAU=nullptr, MemoryDependenceResults *MemDep=nullptr, bool PredecessorWithTwoSuccessors=false, DominatorTree *DT=nullptr)
Attempts to merge a block into its predecessor, if possible.
BasicBlock * 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.
void cloneAndAdaptNoAliasScopes(ArrayRef< MDNode * > NoAliasDeclScopes, ArrayRef< BasicBlock * > NewBlocks, LLVMContext &Context, StringRef Ext)
Clone the specified noalias decl scopes.
bool FoldSingleEntryPHINodes(BasicBlock *BB, MemoryDependenceResults *MemDep=nullptr)
We know that BB has one predecessor.
auto predecessors(const MachineBasicBlock *BB)
static auto filterDbgVars(iterator_range< simple_ilist< DbgRecord >::iterator > R)
Filter the DbgRecord range to DbgVariableRecord types only and downcast.
bool LoopRotation(Loop *L, LoopInfo *LI, const TargetTransformInfo *TTI, AssumptionCache *AC, DominatorTree *DT, ScalarEvolution *SE, MemorySSAUpdater *MSSAU, const SimplifyQuery &SQ, bool RotationOnly, unsigned Threshold, bool IsUtilMode, bool PrepareForLTO=false)
Convert a loop into a loop with bottom test.
hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)
Compute a hash_code for a sequence of values.
void RemapDbgRecordRange(Module *M, iterator_range< DbgRecordIterator > Range, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr)
Remap the Values used in the DbgRecords Range using the value map VM.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Utility to calculate the size and a few similar metrics for a set of basic blocks.
static void collectEphemeralValues(const Loop *L, AssumptionCache *AC, SmallPtrSetImpl< const Value * > &EphValues)
Collect a loop's ephemeral values (those used only by an assume or similar intrinsics in the loop).
Option class for critical edge splitting.