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");
55 const unsigned MaxHeaderSize;
57 const TargetTransformInfo *TTI;
61 MemorySSAUpdater *MSSAU;
62 const SimplifyQuery &SQ;
69 LoopRotate(
unsigned MaxHeaderSize, LoopInfo *LI,
70 const TargetTransformInfo *TTI, AssumptionCache *AC,
71 DominatorTree *DT, ScalarEvolution *SE, MemorySSAUpdater *MSSAU,
72 const SimplifyQuery &SQ,
bool RotationOnly,
bool IsUtilMode,
73 bool PrepareForLTO,
bool CheckExitCount)
74 : MaxHeaderSize(MaxHeaderSize), LI(LI), TTI(TTI), AC(AC), DT(DT), SE(SE),
75 MSSAU(MSSAU), SQ(SQ), RotationOnly(RotationOnly),
76 IsUtilMode(IsUtilMode), PrepareForLTO(PrepareForLTO),
77 CheckExitCount(CheckExitCount) {}
78 bool processLoop(Loop *L);
81 bool rotateLoop(Loop *L,
bool SimplifiedLatch);
82 bool simplifyLoopLatch(Loop *L);
89 bool Inserted = VM.
insert({K, V}).second;
105 PN->removeIncomingValue(OrigPreheader);
110 for (
I = OrigHeader->
begin();
I !=
E; ++
I) {
111 Value *OrigHeaderVal = &*
I;
127 SSA.AddAvailableValue(OrigHeader, OrigHeaderVal);
128 SSA.AddAvailableValue(OrigPreheader, OrigPreHeaderVal);
140 if (UserBB == OrigHeader)
145 if (UserBB == OrigPreheader) {
146 U = OrigPreHeaderVal;
164 if (UserBB == OrigHeader)
172 if (UserBB == OrigPreheader)
173 NewVal = OrigPreHeaderVal;
174 else if (
SSA.HasValueForBlock(UserBB))
175 NewVal =
SSA.GetValueInMiddleOfBlock(UserBB);
178 DVR->replaceVariableLocationOp(OrigHeaderVal, NewVal);
191 if (L->contains(HeaderExit))
194 for (
auto &Phi : Header->phis()) {
197 return cast<Instruction>(U)->getParent() != HeaderExit;
213 bool HasConditionalPreHeader,
216 if (WeightMD ==
nullptr)
227 if (Weights.
size() != 2)
229 uint32_t OrigLoopExitWeight = Weights[0];
230 uint32_t OrigLoopBackedgeWeight = Weights[1];
233 std::swap(OrigLoopExitWeight, OrigLoopBackedgeWeight);
262 if (OrigLoopExitWeight > 0 && OrigLoopBackedgeWeight > 0) {
264 if (HasConditionalPreHeader) {
266 if (OrigLoopBackedgeWeight >= OrigLoopExitWeight) {
275 if ((OrigLoopBackedgeWeight & HighBit) != 0 ||
276 (OrigLoopExitWeight & HighBit) != 0)
278 OrigLoopBackedgeWeight <<= 1;
279 OrigLoopExitWeight <<= 1;
284 ExitWeight0 = OrigLoopExitWeight - OrigLoopBackedgeWeight;
292 if (OrigLoopExitWeight > OrigLoopBackedgeWeight)
293 OrigLoopBackedgeWeight = OrigLoopExitWeight;
295 assert(OrigLoopExitWeight >= ExitWeight0 &&
"Bad branch weight");
296 ExitWeight1 = OrigLoopExitWeight - ExitWeight0;
297 EnterWeight = ExitWeight1;
298 assert(OrigLoopBackedgeWeight >= EnterWeight &&
"Bad branch weight");
299 LoopBackWeight = OrigLoopBackedgeWeight - EnterWeight;
300 }
else if (OrigLoopExitWeight == 0) {
301 if (OrigLoopBackedgeWeight == 0) {
314 LoopBackWeight = OrigLoopBackedgeWeight;
318 assert(OrigLoopBackedgeWeight == 0 &&
"remaining case is backedge zero");
326 SuccsSwapped ? LoopBackWeight : ExitWeight1,
327 SuccsSwapped ? ExitWeight1 : LoopBackWeight,
330 if (HasConditionalPreHeader) {
331 const uint32_t PreHeaderBIWeights[] = {
332 SuccsSwapped ? EnterWeight : ExitWeight0,
333 SuccsSwapped ? ExitWeight0 : EnterWeight,
349bool LoopRotate::rotateLoop(
Loop *L,
bool SimplifiedLatch) {
351 if (
L->getBlocks().size() == 1)
354 bool Rotated =
false;
365 if (!
L->isLoopExiting(OrigHeader))
375 if (
L->isLoopExiting(OrigLatch) && !SimplifiedLatch && IsUtilMode ==
false &&
382 SmallPtrSet<const Value *, 32> EphValues;
386 Metrics.analyzeBasicBlock(OrigHeader, *
TTI, EphValues, PrepareForLTO);
389 dbgs() <<
"LoopRotation: NOT rotating - contains non-duplicatable"
390 <<
" instructions: ";
394 if (
Metrics.Convergence != ConvergenceKind::None) {
395 LLVM_DEBUG(
dbgs() <<
"LoopRotation: NOT rotating - contains convergent "
400 if (!
Metrics.NumInsts.isValid()) {
401 LLVM_DEBUG(
dbgs() <<
"LoopRotation: NOT rotating - contains instructions"
402 " with invalid cost: ";
406 if (
Metrics.NumInsts > MaxHeaderSize) {
409 <<
" instructions, which is more than the threshold ("
410 << MaxHeaderSize <<
" instructions): ";
412 ++NumNotRotatedDueToHeaderSize;
418 if (PrepareForLTO &&
Metrics.NumInlineCandidates > 0)
427 if (!OrigPreheader || !
L->hasDedicatedExits())
436 SE->forgetTopmostLoop(L);
441 SE->forgetBlockAndLoopDispositions();
453 bool BISuccsSwapped =
L->contains(Exit);
456 assert(NewHeader &&
"Unable to determine new loop header");
457 assert(
L->contains(NewHeader) && !
L->contains(Exit) &&
458 "Unable to determine loop header and exit blocks");
463 "New header doesn't have one pred!");
484 std::pair<std::pair<hash_code, DILocalVariable *>, DIExpression *>;
485 auto makeHash = [](
const DbgVariableRecord *
D) -> DbgHash {
486 auto VarLocOps =
D->location_ops();
491 SmallDenseSet<DbgHash, 8> DbgRecords;
494 for (
const DbgVariableRecord &DVR :
496 DbgRecords.
insert(makeHash(&DVR));
502 for (Instruction &
I : *OrigHeader)
506 Module *
M = OrigHeader->getModule();
554 if (!NextDbgInsts.
empty()) {
560 for (DbgVariableRecord &DVR :
562 if (DbgRecords.
count(makeHash(&DVR)))
563 DVR.eraseFromParent();
566 NextDbgInsts =
I->getDbgRecordRange();
581 ++NumInstrsDuplicated;
583 if (!NextDbgInsts.
empty()) {
584 auto Range =
C->cloneDebugInfoFrom(Inst, NextDbgInsts.
begin());
590 if (DbgRecords.
count(makeHash(&DVR)))
591 DVR.eraseFromParent();
606 if (!
C->mayHaveSideEffects()) {
607 C->eraseFromParent();
626 if (!NoAliasDeclInstructions.
empty()) {
651 for (NoAliasScopeDeclInst *NAD : NoAliasDeclInstructions) {
652 LLVM_DEBUG(
dbgs() <<
" Cloning llvm.experimental.noalias.scope.decl:"
655 NewNAD->
insertBefore(*NewHeader, NewHeaderInsertionPoint);
664 for (NoAliasScopeDeclInst *NAD : NoAliasDeclInstructions)
665 NoAliasDeclScopes.
push_back(NAD->getScopeList());
680 auto *LastInst = &OrigPreheader->
back();
693 for (BasicBlock *SuccBB :
successors(OrigHeader))
721 if (!InsertedPHIs.
empty())
725 L->moveToHeader(NewHeader);
726 assert(
L->getHeader() == NewHeader &&
"Latch block is our new header");
733 {DominatorTree::Insert, OrigPreheader,
Exit},
734 {DominatorTree::Insert, OrigPreheader, NewHeader},
735 {DominatorTree::Delete, OrigPreheader, OrigHeader}};
755 const bool HasConditionalPreHeader =
761 if (HasConditionalPreHeader) {
769 OrigPreheader, NewHeader,
770 CriticalEdgeSplittingOptions(DT, LI, MSSAU).setPreserveLCSSA());
778 bool SplitLatchEdge =
false;
779 for (BasicBlock *ExitPred : ExitPreds) {
782 if (!PredLoop || PredLoop->
contains(Exit) ||
785 SplitLatchEdge |=
L->getLoopLatch() == ExitPred;
788 CriticalEdgeSplittingOptions(DT, LI, MSSAU).setPreserveLCSSA());
792 "Despite splitting all preds, failed to split latch exit?");
793 (void)SplitLatchEdge;
797 Exit->removePredecessor(OrigPreheader,
true );
799 NewBI->setDebugLoc(PHBI->getDebugLoc());
800 PHBI->eraseFromParent();
811 assert(
L->getLoopPreheader() &&
"Invalid loop preheader after loop rotation");
812 assert(
L->getLoopLatch() &&
"Invalid loop latch after loop rotation");
821 DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Eager);
822 BasicBlock *PredBB = OrigHeader->getUniquePredecessor();
841 bool seenIncrement =
false;
842 bool MultiExitLoop =
false;
844 if (!L->getExitingBlock())
845 MultiExitLoop =
true;
852 switch (
I->getOpcode()) {
855 case Instruction::GetElementPtr:
861 case Instruction::Add:
862 case Instruction::Sub:
863 case Instruction::And:
864 case Instruction::Or:
865 case Instruction::Xor:
866 case Instruction::Shl:
867 case Instruction::LShr:
868 case Instruction::AShr: {
881 if (!L->contains(UserInst))
888 seenIncrement =
true;
891 case Instruction::Trunc:
892 case Instruction::ZExt:
893 case Instruction::SExt:
909bool LoopRotate::simplifyLoopLatch(Loop *L) {
919 if (!LastExit || !
L->isLoopExiting(LastExit))
929 << LastExit->
getName() <<
"\n");
931 DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Eager);
937 SE->forgetBlockAndLoopDispositions();
947bool LoopRotate::processLoop(Loop *L) {
949 MDNode *LoopMD =
L->getLoopID();
951 bool SimplifiedLatch =
false;
957 SimplifiedLatch = simplifyLoopLatch(L);
959 bool MadeChange = rotateLoop(L, SimplifiedLatch);
960 assert((!MadeChange ||
L->isLoopExiting(
L->getLoopLatch())) &&
961 "Loop latch should be exiting after loop-rotate.");
965 if ((MadeChange || SimplifiedLatch) && LoopMD)
966 L->setLoopID(LoopMD);
968 return MadeChange || SimplifiedLatch;
977 unsigned Threshold =
unsigned(-1),
978 bool IsUtilMode =
true,
bool PrepareForLTO,
979 bool CheckExitCount) {
980 LoopRotate LR(Threshold, LI,
TTI, AC, DT, SE, MSSAU, SQ, RotationOnly,
981 IsUtilMode, PrepareForLTO, CheckExitCount);
982 return LR.processLoop(L);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
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 void updateBranchWeights(CondBrInst &PreHeaderBI, CondBrInst &LoopBI, bool HasConditionalPreHeader, bool SuccsSwapped)
static constexpr uint32_t ZeroTripCountWeights[]
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 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...
static bool profitableToRotateLoopExitingLatch(Loop *L, ScalarEvolution *SE)
Machine Check Debug Module
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
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
A cache of @llvm.assume calls within a function.
LLVM_ABI void registerAssumption(AssumeInst *CI)
Add an @llvm.assume intrinsic to this function's cache.
LLVM Basic Block Representation.
iterator begin()
Instruction iterator methods.
const Instruction & back() const
bool hasAddressTaken() const
Returns true if there are any uses of this basic block other than direct branches,...
LLVM_ABI InstListType::const_iterator getFirstNonPHIIt() const
Returns an iterator to the first instruction in this block that is not a PHINode instruction.
LLVM_ABI const BasicBlock * getSinglePredecessor() const
Return the predecessor of this block if it has a single predecessor block.
LLVM_ABI void flushTerminatorDbgRecords()
Eject any debug-info trailing at the end of a block.
LLVM_ABI 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...
LLVM_ABI 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...
Conditional Branch instruction.
Value * getCondition() const
BasicBlock * getSuccessor(unsigned i) const
static iterator_range< simple_ilist< DbgRecord >::iterator > getEmptyDbgRecordRange()
LLVM_ABI const BasicBlock * getParent() const
Record of a variable value-assignment, aka a non instruction representation of the dbg....
void applyUpdates(ArrayRef< UpdateType > Updates)
Inform the dominator tree about a sequence of CFG edge insertions and deletions and perform a batch u...
void deleteEdge(NodeT *From, NodeT *To)
Inform the dominator tree about a CFG edge deletion and update the tree.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
bool isPresplitCoroutine() const
Determine if the function is presplit coroutine.
LLVM_ABI Instruction * clone() const
Create a copy of 'this' instruction that is identical in all ways except the following:
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI void moveBefore(InstListType::iterator InsertPos)
Unlink this instruction from its current basic block and insert it into the basic block that MovePos ...
LLVM_ABI void insertBefore(InstListType::iterator InsertPos)
Insert an unlinked instruction into a basic block immediately before the specified position.
LLVM_ABI InstListType::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
LLVM_ABI const Function * getFunction() const
Return the function this instruction belongs to.
bool isTerminator() const
LLVM_ABI bool mayReadFromMemory() const LLVM_READONLY
Return true if this instruction may read memory.
bool contains(const LoopT *L) const
Return true if the specified loop is contained within in this loop.
LoopT * getLoopFor(const BlockT *BB) const
Return the inner most loop that BB lives in.
bool replacementPreservesLCSSAForm(Instruction *From, Value *To)
Returns true if replacing From with To everywhere is guaranteed to preserve LCSSA form.
Represents a single loop in the control flow graph.
MemorySSA * getMemorySSA() const
Get handle on MemorySSA.
LLVM_ABI void removeEdge(BasicBlock *From, BasicBlock *To)
Update the MemoryPhi in To following an edge deletion between From and To.
LLVM_ABI void updateForClonedBlockIntoPred(BasicBlock *BB, BasicBlock *P1, const ValueToValueMapTy &VM)
LLVM_ABI void applyUpdates(ArrayRef< CFGUpdate > Updates, DominatorTree &DT, bool UpdateDTFirst=false)
Apply CFG updates, analogous with the DT edge updates.
LLVM_ABI void verifyMemorySSA(VerificationLevel=VerificationLevel::Fast) const
Verify that MemorySSA is self consistent (IE definitions dominate all uses, uses appear in the right ...
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
Value * getIncomingValueForBlock(const BasicBlock *BB) const
static LLVM_ABI PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
Helper class for SSA formation on a set of values defined in multiple blocks.
The main scalar evolution driver.
LLVM_ABI 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...
LLVM_ABI 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...
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 UncondBrInst * Create(BasicBlock *IfTrue, InsertPosition InsertBefore=nullptr)
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.
LLVM_ABI void setName(const Twine &Name)
Change the name of the value.
iterator_range< user_iterator > users()
iterator_range< use_iterator > uses()
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
LLVM_ABI 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()
@ C
The default llvm calling convention, compatible with C.
@ BasicBlock
Various leaf nodes.
friend class Instruction
Iterator for Instructions in a `BasicBlock.
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
LLVM_ABI bool RemoveRedundantDbgInstrs(BasicBlock *BB)
Try to remove redundant dbg.value instructions from given basic block.
LLVM_ABI 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, bool CheckExitCount=false)
Convert a loop into a loop with bottom test.
LLVM_ABI void findDbgValues(Value *V, SmallVectorImpl< DbgVariableRecord * > &DbgVariableRecords)
Finds the dbg.values describing a value.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
auto successors(const MachineBasicBlock *BB)
LLVM_ABI 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...
LLVM_ABI bool isSafeToSpeculativelyExecute(const Instruction *I, const Instruction *CtxI=nullptr, AssumptionCache *AC=nullptr, const DominatorTree *DT=nullptr, const TargetLibraryInfo *TLI=nullptr, bool UseVariableInfo=true, bool IgnoreUBImplyingAttrs=true)
Return true if the instruction does not have any effects besides calculating the result and does not ...
LLVM_ABI void insertDebugValuesForPHIs(BasicBlock *BB, SmallVectorImpl< PHINode * > &InsertedPHIs)
Propagate dbg.value intrinsics through the newly inserted PHIs.
LLVM_ABI Value * simplifyInstruction(Instruction *I, const SimplifyQuery &Q)
See if we can compute a simplified version of this instruction.
LLVM_ABI void setBranchWeights(Instruction &I, ArrayRef< uint32_t > Weights, bool IsExpected, bool ElideAllZero=false)
Create a new branch_weights metadata node and add or overwrite a prof metadata reference to instructi...
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
void RemapDbgRecordRange(Module *M, iterator_range< DbgRecordIterator > Range, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr, const MetadataPredicate *IdentityMD=nullptr)
Remap the Values used in the DbgRecords Range using the value map VM.
@ 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...
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
iterator_range(Container &&) -> iterator_range< llvm::detail::IterOfRange< Container > >
LLVM_ABI void extractFromBranchWeightMD32(const MDNode *ProfileData, SmallVectorImpl< uint32_t > &Weights)
Faster version of extractBranchWeights() that skips checks and must only be called with "branch_weigh...
LLVM_ABI bool VerifyMemorySSA
Enables verification of MemorySSA.
LLVM_ABI 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.
void RemapInstruction(Instruction *I, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr, const MetadataPredicate *IdentityMD=nullptr)
Convert the instruction operands from referencing the current values into those specified by VM.
LLVM_ABI 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.
LLVM_ABI void cloneAndAdaptNoAliasScopes(ArrayRef< MDNode * > NoAliasDeclScopes, ArrayRef< BasicBlock * > NewBlocks, LLVMContext &Context, StringRef Ext)
Clone the specified noalias decl scopes.
LLVM_ABI bool FoldSingleEntryPHINodes(BasicBlock *BB, MemoryDependenceResults *MemDep=nullptr)
We know that BB has one predecessor.
ValueMap< const Value *, WeakTrackingVH > ValueToValueMapTy
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
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.
hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)
Compute a hash_code for a sequence of values.
LLVM_ABI void mapAtomInstance(const DebugLoc &DL, ValueToValueMapTy &VMap)
Mark a cloned instruction as a new instance so that its source loc can be updated when remapped.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
static LLVM_ABI 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).