15#define DEBUG_TYPE "loop-constrainer"
19 const SCEV *Start,
const SCEV *Bound) {
33 unsigned LatchBrExitIdx,
Loop *L,
49 LLVM_DEBUG(
dbgs() <<
"LatchExitBrIdx: " << LatchBrExitIdx <<
"\n");
57 if (LatchBrExitIdx == 1)
60 assert(LatchBrExitIdx == 0 &&
"LatchBrExitIdx should be either 0 or 1");
68 const SCEV *MinusOne =
79 unsigned LatchBrExitIdx,
Loop *L,
93 LLVM_DEBUG(
dbgs() <<
"LatchExitBrIdx: " << LatchBrExitIdx <<
"\n");
101 if (LatchBrExitIdx == 1)
104 assert(LatchBrExitIdx == 0 &&
"LatchBrExitIdx should be 0 or 1");
123 const SCEV *FromBlock =
130std::optional<LoopStructure>
132 bool AllowUnsignedLatchCond,
133 const char *&FailureReason) {
134 if (!L.isLoopSimplifyForm()) {
135 FailureReason =
"loop not in LoopSimplify form";
140 assert(
Latch &&
"Simplified loops only have one latch!");
143 FailureReason =
"loop has already been cloned";
147 if (!L.isLoopExiting(
Latch)) {
148 FailureReason =
"no loop latch";
155 FailureReason =
"no preheader";
161 FailureReason =
"latch terminator not conditional branch";
169 FailureReason =
"latch terminator branch not conditional on integral icmp";
175 FailureReason =
"could not compute latch count";
180 "loop variant exit count doesn't make sense!");
197 FailureReason =
"no add recurrences in the icmp";
203 if (AR->hasNoSignedWrap())
214 const SCEV *ExtendedStep =
217 bool NoSignedWrap = ExtendAfterOp->
getStart() == ExtendedStart &&
225 return AR->hasNoSignedWrap();
233 FailureReason =
"LHS in cmp is not an AddRec for this loop";
237 FailureReason =
"LHS in icmp not induction variable";
242 FailureReason =
"LHS in icmp not induction variable";
248 FailureReason =
"LHS in icmp needs nsw for equality predicates";
260 const SCEV *FixedRightSCEV =
nullptr;
265 if (L.contains(
I->getParent()))
266 FixedRightSCEV = RightSCEV;
269 bool DecreasedRightValueByOne =
false;
270 if (StepCI->
isOne()) {
295 DecreasedRightValueByOne =
true;
300 DecreasedRightValueByOne =
true;
307 bool FoundExpectedPred =
310 if (!FoundExpectedPred) {
311 FailureReason =
"expected icmp slt semantically, found something else";
317 FailureReason =
"unsigned latch conditions are explicitly prohibited";
323 FailureReason =
"Unsafe loop bounds";
329 if (!DecreasedRightValueByOne)
333 assert(!DecreasedRightValueByOne &&
334 "Right value can be decreased only for LatchBrExitIdx == 0!");
337 bool IncreasedRightValueByOne =
false;
358 IncreasedRightValueByOne =
true;
362 IncreasedRightValueByOne =
true;
370 bool FoundExpectedPred =
373 if (!FoundExpectedPred) {
374 FailureReason =
"expected icmp sgt semantically, found something else";
382 FailureReason =
"unsigned latch conditions are explicitly prohibited";
388 FailureReason =
"Unsafe bounds";
395 if (!IncreasedRightValueByOne)
399 assert(!IncreasedRightValueByOne &&
400 "Right value can be increased only for LatchBrExitIdx == 0!");
414 IndVarStartV->
setName(
"indvar.start");
420 Result.Latch =
Latch;
424 Result.IndVarStart = IndVarStartV;
425 Result.IndVarStep = StepCI;
426 Result.IndVarBase = LeftValue;
427 Result.IndVarIncreasing = IsIncreasing;
428 Result.LoopExitAt = RightValue;
432 FailureReason =
nullptr;
442 LLVMContext &Context = L.getHeader()->getContext();
446 Context, {
MDString::get(Context,
"llvm.loop.unroll.disable")});
451 {
MDString::get(Context,
"llvm.loop.vectorize.enable"), FalseVal});
453 Context, {
MDString::get(Context,
"llvm.loop.licm_versioning.disable")});
455 Context, {
MDString::get(Context,
"llvm.loop.distribute.disable")});
457 MDNode::get(Context, {Dummy, DisableUnroll, DisableVectorize,
458 DisableLICMVersioning, DisableDistribution});
461 L.setLoopID(NewLoopID);
469 DT(DT), LI(LI), LPMAddNewLoop(LPMAddNewLoop), OriginalLoop(L), RangeTy(
T),
470 MainLoopStructure(LS), SR(SR) {}
472void LoopConstrainer::cloneLoop(LoopConstrainer::ClonedLoop &Result,
473 const char *
Tag)
const {
476 Result.Blocks.push_back(Clone);
477 Result.Map[BB] = Clone;
480 auto GetClonedValue = [&Result](
Value *V) {
481 assert(V &&
"null values not in domain!");
482 auto It = Result.Map.find(V);
483 if (It == Result.Map.end())
485 return static_cast<Value *
>(It->second);
493 Result.Structure = MainLoopStructure.map(GetClonedValue);
496 for (
unsigned i = 0, e =
Result.Blocks.size(); i != e; ++i) {
498 BasicBlock *OriginalBB = OriginalLoop.getBlocks()[i];
500 assert(
Result.Map[OriginalBB] == ClonedBB &&
"invariant!");
502 for (Instruction &
I : *ClonedBB)
511 if (OriginalLoop.contains(SBB))
514 for (PHINode &PN : SBB->phis()) {
515 Value *OldIncoming = PN.getIncomingValueForBlock(OriginalBB);
516 PN.addIncoming(GetClonedValue(OldIncoming), ClonedBB);
517 SE.forgetLcssaPhiWithNewPredecessor(&OriginalLoop, &PN);
523LoopConstrainer::RewrittenRangeInfo LoopConstrainer::changeIterationSpaceEnd(
597 RewrittenRangeInfo RRI;
601 &F, BBInsertLocation);
606 bool Increasing =
LS.IndVarIncreasing;
607 bool IsSignedPredicate =
LS.IsSignedPredicate;
610 auto NoopOrExt = [&](
Value *
V) {
611 if (
V->getType() == RangeTy)
613 return IsSignedPredicate ?
B.CreateSExt(V, RangeTy,
"wide." +
V->getName())
614 :
B.CreateZExt(V, RangeTy,
"wide." +
V->getName());
618 Value *EnterLoopCond =
nullptr;
622 : (IsSignedPredicate ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT);
623 Value *IndVarStart = NoopOrExt(
LS.IndVarStart);
624 EnterLoopCond =
B.CreateICmp(Pred, IndVarStart, ExitSubloopAt);
626 B.CreateCondBr(EnterLoopCond,
LS.Header, RRI.PseudoExit);
629 LS.LatchBr->setSuccessor(
LS.LatchBrExitIdx, RRI.ExitSelector);
630 B.SetInsertPoint(
LS.LatchBr);
631 Value *IndVarBase = NoopOrExt(
LS.IndVarBase);
632 Value *TakeBackedgeLoopCond =
B.CreateICmp(Pred, IndVarBase, ExitSubloopAt);
634 Value *CondForBranch =
LS.LatchBrExitIdx == 1
635 ? TakeBackedgeLoopCond
636 :
B.CreateNot(TakeBackedgeLoopCond);
638 LS.LatchBr->setCondition(CondForBranch);
640 B.SetInsertPoint(RRI.ExitSelector);
645 Value *LoopExitAt = NoopOrExt(
LS.LoopExitAt);
646 Value *IterationsLeft =
B.CreateICmp(Pred, IndVarBase, LoopExitAt);
647 B.CreateCondBr(IterationsLeft, RRI.PseudoExit,
LS.LatchExit);
649 UncondBrInst *BranchToContinuation =
655 for (PHINode &PN :
LS.Header->phis()) {
656 PHINode *NewPHI =
PHINode::Create(PN.getType(), 2, PN.getName() +
".copy",
657 BranchToContinuation->getIterator());
659 NewPHI->
addIncoming(PN.getIncomingValueForBlock(Preheader), Preheader);
662 RRI.PHIValuesAtPseudoExit.push_back(NewPHI);
666 BranchToContinuation->getIterator());
667 RRI.IndVarEnd->addIncoming(IndVarStart, Preheader);
668 RRI.IndVarEnd->addIncoming(IndVarBase, RRI.ExitSelector);
672 LS.LatchExit->replacePhiUsesWith(
LS.Latch, RRI.ExitSelector);
677void LoopConstrainer::rewriteIncomingValuesForPHIs(
679 const LoopConstrainer::RewrittenRangeInfo &RRI)
const {
680 unsigned PHIIndex = 0;
681 for (PHINode &PN :
LS.Header->phis())
682 PN.setIncomingValueForBlock(ContinuationBlock,
683 RRI.PHIValuesAtPseudoExit[PHIIndex++]);
685 LS.IndVarStart = RRI.IndVarEnd;
690 const char *
Tag)
const {
694 LS.Header->replacePhiUsesWith(OldPreheader, Preheader);
700 Loop *ParentLoop = OriginalLoop.getParentLoop();
704 for (BasicBlock *BB : BBs)
708Loop *LoopConstrainer::createClonedLoopStructure(
Loop *Original,
Loop *Parent,
711 Loop &
New = *LI.AllocateLoop();
715 LI.addTopLevelLoop(&New);
716 LPMAddNewLoop(&New, IsSubloop);
719 for (
auto *BB : Original->
blocks())
720 if (LI.getLoopFor(BB) == Original)
724 for (Loop *SubLoop : *Original)
725 createClonedLoopStructure(SubLoop, &New, VM,
true);
731 BasicBlock *Preheader = OriginalLoop.getLoopPreheader();
732 assert(Preheader !=
nullptr &&
"precondition!");
734 OriginalPreheader = Preheader;
735 MainLoopPreheader = Preheader;
736 bool IsSignedPredicate = MainLoopStructure.IsSignedPredicate;
737 bool Increasing = MainLoopStructure.IndVarIncreasing;
741 Instruction *InsertPt = OriginalPreheader->getTerminator();
746 ClonedLoop PreLoop, PostLoop;
748 Increasing ? SR.LowLimit.has_value() : SR.HighLimit.has_value();
750 Increasing ? SR.HighLimit.has_value() : SR.LowLimit.has_value();
752 Value *ExitPreLoopAt =
nullptr;
753 Value *ExitMainLoopAt =
nullptr;
758 const SCEV *ExitPreLoopAtSCEV =
nullptr;
761 ExitPreLoopAtSCEV = *SR.LowLimit;
764 ExitPreLoopAtSCEV = SE.getAddExpr(*SR.HighLimit, MinusOneS);
766 LLVM_DEBUG(
dbgs() <<
"could not prove no-overflow when computing "
767 <<
"preloop exit limit. HighLimit = "
768 << *(*SR.HighLimit) <<
"\n");
773 LLVM_DEBUG(
dbgs() <<
"could not prove that it is safe to expand the"
774 <<
" preloop exit limit " << *ExitPreLoopAtSCEV
775 <<
" at block " << InsertPt->
getParent()->getName()
780 ExitPreLoopAt = Expander.
expandCodeFor(ExitPreLoopAtSCEV, IVTy, InsertPt);
781 ExitPreLoopAt->
setName(
"exit.preloop.at");
785 const SCEV *ExitMainLoopAtSCEV =
nullptr;
788 ExitMainLoopAtSCEV = *SR.HighLimit;
791 ExitMainLoopAtSCEV = SE.getAddExpr(*SR.LowLimit, MinusOneS);
793 LLVM_DEBUG(
dbgs() <<
"could not prove no-overflow when computing "
794 <<
"mainloop exit limit. LowLimit = "
795 << *(*SR.LowLimit) <<
"\n");
800 LLVM_DEBUG(
dbgs() <<
"could not prove that it is safe to expand the"
801 <<
" main loop exit limit " << *ExitMainLoopAtSCEV
802 <<
" at block " << InsertPt->
getParent()->getName()
807 ExitMainLoopAt = Expander.
expandCodeFor(ExitMainLoopAtSCEV, IVTy, InsertPt);
808 ExitMainLoopAt->
setName(
"exit.mainloop.at");
814 cloneLoop(PreLoop,
"preloop");
816 cloneLoop(PostLoop,
"postloop");
818 RewrittenRangeInfo PreLoopRRI;
822 PreLoop.Structure.
Header);
825 createPreheader(MainLoopStructure, Preheader,
"mainloop");
826 PreLoopRRI = changeIterationSpaceEnd(PreLoop.Structure, Preheader,
827 ExitPreLoopAt, MainLoopPreheader);
828 rewriteIncomingValuesForPHIs(MainLoopStructure, MainLoopPreheader,
833 RewrittenRangeInfo PostLoopRRI;
837 createPreheader(PostLoop.Structure, Preheader,
"postloop");
838 PostLoopRRI = changeIterationSpaceEnd(MainLoopStructure, MainLoopPreheader,
839 ExitMainLoopAt, PostLoopPreheader);
840 rewriteIncomingValuesForPHIs(PostLoop.Structure, PostLoopPreheader,
845 MainLoopPreheader != Preheader ? MainLoopPreheader :
nullptr;
846 BasicBlock *NewBlocks[] = {PostLoopPreheader, PreLoopRRI.PseudoExit,
847 PreLoopRRI.ExitSelector, PostLoopRRI.PseudoExit,
848 PostLoopRRI.ExitSelector, NewMainLoopPreheader};
853 std::remove(std::begin(NewBlocks), std::end(NewBlocks),
nullptr);
855 addToParentLoopIfNeeded(
ArrayRef(std::begin(NewBlocks), NewBlocksEnd));
863 Loop *PreL =
nullptr, *PostL =
nullptr;
864 if (!PreLoop.Blocks.empty()) {
865 PreL = createClonedLoopStructure(&OriginalLoop,
866 OriginalLoop.getParentLoop(), PreLoop.Map,
870 if (!PostLoop.Blocks.empty()) {
872 createClonedLoopStructure(&OriginalLoop, OriginalLoop.getParentLoop(),
873 PostLoop.Map,
false);
877 auto CanonicalizeLoop = [&](
Loop *L,
bool IsOriginalLoop) {
886 CanonicalizeLoop(PreL,
false);
888 CanonicalizeLoop(PostL,
false);
889 CanonicalizeLoop(&OriginalLoop,
true);
899 if (IsSignedPredicate)
901 ->setHasNoSignedWrap(
true);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static const Function * getParent(const Value *V)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static const char * ClonedLoopTag
static bool isLoopEntryGuardedByCond(ScalarEvolution &SE, Loop *L, ICmpInst::Predicate Pred, const SCEV *Start, const SCEV *Bound)
static const SCEV * getNarrowestLatchMaxTakenCountEstimate(ScalarEvolution &SE, const Loop &L)
Returns estimate for max latch taken count of the loop of the narrowest available type.
static bool isSafeDecreasingBound(const SCEV *Start, const SCEV *BoundSCEV, const SCEV *Step, ICmpInst::Predicate Pred, unsigned LatchBrExitIdx, Loop *L, ScalarEvolution &SE)
Given a loop with an deccreasing induction variable, is it possible to safely calculate the bounds of...
static void DisableAllLoopOptsOnLoop(Loop &L)
static bool isSafeIncreasingBound(const SCEV *Start, const SCEV *BoundSCEV, const SCEV *Step, ICmpInst::Predicate Pred, unsigned LatchBrExitIdx, Loop *L, ScalarEvolution &SE)
Given a loop with an increasing induction variable, is it possible to safely calculate the bounds of ...
Func getContext().diagnose(DiagnosticInfoUnsupported(Func
Class for arbitrary precision integers.
static APInt getMaxValue(unsigned numBits)
Gets maximum unsigned value of APInt for specific bit width.
static APInt getSignedMaxValue(unsigned numBits)
Gets maximum signed value of APInt for a specific bit width.
static APInt getMinValue(unsigned numBits)
Gets minimum unsigned value of APInt for a specific bit width.
static APInt getSignedMinValue(unsigned numBits)
Gets minimum signed value of APInt for a specific bit width.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction; assumes that the block is well-formed.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
@ ICMP_SLT
signed less than
@ ICMP_UGT
unsigned greater than
@ ICMP_SGT
signed greater than
@ ICMP_ULT
unsigned less than
Predicate getSwappedPredicate() const
For example, EQ->EQ, SLE->SGE, ULT->UGT, OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
Predicate getPredicate() const
Return the predicate for this instruction.
Conditional Branch instruction.
This is the shared class of boolean and integer constants.
bool isMinusOne() const
This function will return true iff every bit in this constant is set to true.
bool isOne() const
This is just a convenience method to make client code smaller for a common case.
bool isZero() const
This is just a convenience method to make client code smaller for a common code.
const APInt & getValue() const
Return the constant as an APInt value reference.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
This instruction compares its operands according to the predicate given to the constructor.
static bool isEquality(Predicate P)
Return true if this predicate is either EQ or NE.
LLVM_ABI InstListType::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
Class to represent integer types.
static LLVM_ABI IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
This is an important class for using LLVM in a threaded context.
void addBasicBlockToLoop(BlockT *NewBB, LoopInfoBase< BlockT, LoopT > &LI)
This method is used by other analyses to update loop information.
iterator_range< block_iterator > blocks() const
void addChildLoop(LoopT *NewChild)
Add the specified loop to be a child of this loop.
ArrayRef< BlockT * > getBlocks() const
Get a list of the basic blocks which make up this loop.
LLVM_ABI LoopConstrainer(Loop &L, LoopInfo &LI, function_ref< void(Loop *, bool)> LPMAddNewLoop, const LoopStructure &LS, ScalarEvolution &SE, DominatorTree &DT, Type *T, SubRanges SR)
Represents a single loop in the control flow graph.
LLVM_ABI void replaceOperandWith(unsigned I, Metadata *New)
Replace a specific operand.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static LLVM_ABI MDString * get(LLVMContext &Context, StringRef Str)
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
static PHINode * Create(Type *Ty, unsigned NumReservedValues, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
Constructors - NumReservedValues is a hint for the number of incoming edges that this phi node will h...
This node represents a polynomial recurrence on the trip count of the specified loop.
SCEVUse getStepRecurrence(ScalarEvolution &SE) const
Constructs and returns the recurrence indicating how much this expression steps by.
This class represents a constant integer value.
This class uses information about analyze scalars to rewrite expressions in canonical form.
LLVM_ABI bool isSafeToExpandAt(const SCEV *S, const Instruction *InsertionPoint) const
Return true if the given expression is safe to expand in the sense that all materialized values are d...
LLVM_ABI Value * expandCodeFor(SCEVUse SH, Type *Ty, BasicBlock::iterator I)
Insert code to directly compute the specified SCEV expression into the program.
This class represents an analyzed expression in the program.
LLVM_ABI Type * getType() const
Return the LLVM type of this SCEV expression.
The main scalar evolution driver.
LLVM_ABI const SCEV * getNegativeSCEV(const SCEV *V, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap)
Return the SCEV object corresponding to -V.
LLVM_ABI bool isKnownNegative(const SCEV *S)
Test if the given expression is known to be negative.
LLVM_ABI bool isLoopEntryGuardedByCond(const Loop *L, CmpPredicate Pred, const SCEV *LHS, const SCEV *RHS)
Test whether entry to the loop is protected by a conditional between LHS and RHS.
LLVM_ABI const SCEV * getConstant(ConstantInt *V)
LLVM_ABI const SCEV * getSCEV(Value *V)
Return a SCEV expression for the full generality of the specified expression.
LLVM_ABI const SCEV * getMinusSCEV(SCEVUse LHS, SCEVUse RHS, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap, unsigned Depth=0)
Return LHS-RHS.
const SCEV * getOne(Type *Ty)
Return a SCEV for the constant 1 of a specific type.
LLVM_ABI LoopDisposition getLoopDisposition(const SCEV *S, const Loop *L)
Return the "disposition" of the given SCEV with respect to the given loop.
@ LoopInvariant
The SCEV is loop-invariant.
LLVM_ABI bool isAvailableAtLoopEntry(const SCEV *S, const Loop *L)
Determine if the SCEV can be evaluated at loop's entry.
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...
LLVM_ABI const SCEV * getSignExtendExpr(const SCEV *Op, Type *Ty, unsigned Depth=0)
LLVM_ABI const SCEV * getAddExpr(SmallVectorImpl< SCEVUse > &Ops, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap, unsigned Depth=0)
Get a canonical add expression, or something simpler if possible.
@ SymbolicMaximum
An expression which provides an upper bound on the exact trip count.
LLVM_ABI const SCEV * applyLoopGuards(const SCEV *Expr, const Loop *L)
Try to apply information from loop guards for L to Expr.
const SCEV * getSymbolicMaxBackedgeTakenCount(const Loop *L)
When successful, this returns a SCEV that is greater than or equal to (i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI IntegerType * getInt1Ty(LLVMContext &C)
static UncondBrInst * Create(BasicBlock *Target, InsertPosition InsertBefore=nullptr)
LLVM_ABI bool replaceUsesOfWith(Value *From, Value *To)
Replace uses of one Value with another.
Value * getOperand(unsigned i) const
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.
An efficient, type-erasing, non-owning reference to a callable.
const ParentTy * getParent() const
@ BasicBlock
Various leaf nodes.
friend class Instruction
Iterator for Instructions in a `BasicBlock.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI bool simplifyLoop(Loop *L, DominatorTree *DT, LoopInfo *LI, ScalarEvolution *SE, AssumptionCache *AC, MemorySSAUpdater *MSSAU, bool PreserveLCSSA)
Simplify each loop in a loop nest recursively.
LLVM_ABI BasicBlock * CloneBasicBlock(const BasicBlock *BB, ValueToValueMapTy &VMap, const Twine &NameSuffix="", Function *F=nullptr, ClonedCodeInfo *CodeInfo=nullptr, bool MapAtoms=true)
Return a copy of the specified basic block, but without embedding the block into a particular functio...
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 bool formLCSSARecursively(Loop &L, const DominatorTree &DT, const LoopInfo *LI, ScalarEvolution *SE)
Put a loop nest into LCSSA form.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
LLVM_ABI bool cannotBeMaxInLoop(const SCEV *S, const Loop *L, ScalarEvolution &SE, bool Signed)
Returns true if S is defined and never is equal to signed/unsigned max.
@ 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.
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...
IRBuilder(LLVMContext &, FolderTy, InserterTy, MDNode *, ArrayRef< OperandBundleDef >) -> IRBuilder< FolderTy, InserterTy >
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.
ArrayRef(const T &OneElt) -> ArrayRef< T >
constexpr unsigned BitWidth
ValueMap< const Value *, WeakTrackingVH > ValueToValueMapTy
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI bool cannotBeMinInLoop(const SCEV *S, const Loop *L, ScalarEvolution &SE, bool Signed)
Returns true if S is defined and never is equal to signed/unsigned min.
LLVM_ABI bool isKnownNonNegativeInLoop(const SCEV *S, const Loop *L, ScalarEvolution &SE)
Returns true if we can prove that S is defined and always non-negative in loop L.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
static LLVM_ABI std::optional< LoopStructure > parseLoopStructure(ScalarEvolution &, Loop &, bool, const char *&)