86using namespace PatternMatch;
88#define DEBUG_TYPE "indvars"
91STATISTIC(NumReplaced ,
"Number of exit values replaced");
92STATISTIC(NumLFTR ,
"Number of loop exit tests replaced");
93STATISTIC(NumElimExt ,
"Number of IV sign/zero extends eliminated");
94STATISTIC(NumElimIV ,
"Number of congruent IVs eliminated");
101 cl::desc(
"Verify the ScalarEvolution result after running indvars. Has no "
102 "effect in release builds. (Note: this adds additional SCEV "
103 "queries potentially changing the analysis result)"));
107 cl::desc(
"Choose the strategy to replace exit value in IndVarSimplify"),
111 "only replace exit value when the cost is cheap"),
114 "only replace exit value when it is an unused "
115 "induction variable in the loop and has cheap replacement cost"),
117 "only replace exit values when loop def likely dead"),
119 "always replace exit value whenever possible")));
123 cl::desc(
"Use post increment control-dependent ranges in IndVarSimplify"),
128 cl::desc(
"Disable Linear Function Test Replace optimization"));
132 cl::desc(
"Predicate conditions in read only loops"));
136 cl::desc(
"Allow widening of indvars to eliminate s/zext"));
140class IndVarSimplify {
147 std::unique_ptr<MemorySSAUpdater> MSSAU;
153 bool rewriteNonIntegerIVs(
Loop *L);
159 bool canonicalizeExitCondition(
Loop *L);
166 bool rewriteFirstIterationLoopExitValues(
Loop *L);
169 const SCEV *ExitCount,
172 bool sinkUnusedInvariants(
Loop *L);
178 : LI(LI), SE(SE), DT(DT),
DL(
DL), TLI(TLI),
TTI(
TTI),
179 WidenIndVars(WidenIndVars) {
181 MSSAU = std::make_unique<MemorySSAUpdater>(MSSA);
195 bool isExact =
false;
199 APFloat::rmTowardZero, &isExact) != APFloat::opOK ||
214bool IndVarSimplify::handleFloatingPointIV(
Loop *L,
PHINode *PN) {
216 unsigned BackEdge = IncomingEdge^1;
219 auto *InitValueVal = dyn_cast<ConstantFP>(PN->
getIncomingValue(IncomingEdge));
222 if (!InitValueVal || !
ConvertToSInt(InitValueVal->getValueAPF(), InitValue))
228 if (Incr ==
nullptr || Incr->getOpcode() != Instruction::FAdd)
return false;
232 ConstantFP *IncValueVal = dyn_cast<ConstantFP>(Incr->getOperand(1));
234 if (IncValueVal ==
nullptr || Incr->getOperand(0) != PN ||
242 if (IncrUse == Incr->user_end())
return false;
244 if (IncrUse != Incr->user_end())
return false;
250 Compare = dyn_cast<FCmpInst>(U2);
251 if (!Compare || !
Compare->hasOneUse() ||
252 !isa<BranchInst>(
Compare->user_back()))
271 if (ExitValueVal ==
nullptr ||
277 switch (
Compare->getPredicate()) {
278 default:
return false;
300 if (!isInt<32>(InitValue) || !isInt<32>(IncValue) || !isInt<32>(ExitValue))
311 if (InitValue >= ExitValue)
318 if (++Range == 0)
return false;
332 if (Leftover != 0 && int32_t(ExitValue+IncValue) < ExitValue)
337 if (InitValue <= ExitValue)
344 if (++Range == 0)
return false;
358 if (Leftover != 0 && int32_t(ExitValue+IncValue) > ExitValue)
385 Compare->replaceAllUsesWith(NewCompare);
408bool IndVarSimplify::rewriteNonIntegerIVs(
Loop *L) {
415 for (
PHINode &PN : Header->phis())
418 bool Changed =
false;
419 for (
unsigned i = 0, e = PHIs.
size(); i != e; ++i)
420 if (
PHINode *PN = dyn_cast_or_null<PHINode>(&*PHIs[i]))
421 Changed |= handleFloatingPointIV(L, PN);
440bool IndVarSimplify::rewriteFirstIterationLoopExitValues(
Loop *L) {
447 bool MadeAnyChanges =
false;
448 for (
auto *ExitBB : ExitBlocks) {
451 for (
PHINode &PN : ExitBB->phis()) {
453 IncomingValIdx !=
E; ++IncomingValIdx) {
469 if (
auto *BI = dyn_cast<BranchInst>(TermInst)) {
472 Cond = BI->getCondition();
473 }
else if (
auto *SI = dyn_cast<SwitchInst>(TermInst))
474 Cond =
SI->getCondition();
484 if (!ExitVal || ExitVal->getParent() != L->
getHeader())
491 assert(LoopPreheader &&
"Invalid loop");
492 int PreheaderIdx = ExitVal->getBasicBlockIndex(LoopPreheader);
493 if (PreheaderIdx != -1) {
495 "ExitVal must be in loop header");
496 MadeAnyChanges =
true;
498 ExitVal->getIncomingValue(PreheaderIdx));
499 SE->forgetValue(&PN);
504 return MadeAnyChanges;
517 bool IsSigned = Cast->
getOpcode() == Instruction::SExt;
518 if (!IsSigned && Cast->
getOpcode() != Instruction::ZExt)
531 if (NarrowIVWidth >= Width)
571class IndVarSimplifyVisitor :
public IVVisitor {
598bool IndVarSimplify::simplifyAndExtend(
Loop *L,
603 auto *GuardDecl = L->
getBlocks()[0]->getModule()->getFunction(
605 bool HasGuards = GuardDecl && !GuardDecl->use_empty();
615 bool Changed =
false;
616 while (!LoopPhis.
empty()) {
627 IndVarSimplifyVisitor Visitor(CurrIV, SE,
TTI, DT);
632 if (Visitor.WI.WidestNativeType) {
635 }
while(!LoopPhis.
empty());
645 DT, DeadInsts, ElimExt, Widened,
647 NumElimExt += ElimExt;
648 NumWidened += Widened;
670 case Instruction::Add:
671 case Instruction::Sub:
673 case Instruction::GetElementPtr:
688 if (IncI->
getOpcode() == Instruction::GetElementPtr)
733 if (Pred != ICmpInst::ICMP_NE && Pred != ICmpInst::ICMP_EQ)
782 while (!Worklist.
empty()) {
791 if (
I != Root && !
any_of(
I->operands(), [&KnownPoison](
const Use &U) {
792 return KnownPoison.contains(U) && propagatesPoison(U);
796 if (KnownPoison.
insert(
I).second)
811 if (isa<Constant>(V))
812 return !isa<UndefValue>(V);
824 if(
I->mayReadFromMemory() || isa<CallInst>(
I) || isa<InvokeInst>(
I))
828 for (
Value *Op :
I->operands()) {
829 if (!Visited.
insert(Op).second)
855 if (U !=
Cond && U != IncV)
return false;
858 if (U !=
Cond && U != Phi)
return false;
878 if (!Step || !Step->
isOne())
884 isa<SCEVAddRecExpr>(SE->
getSCEV(IncV)));
903 const SCEV *BestInit =
nullptr;
905 assert(LatchBlock &&
"Must be in simplified form");
917 const auto *AR = cast<SCEVAddRecExpr>(SE->
getSCEV(Phi));
923 if (PhiWidth < BCWidth || !
DL.isLegalInteger(PhiWidth))
966 else if (PhiWidth <= SE->getTypeSizeInBits(BestPhi->
getType()))
979 const SCEV *ExitCount,
bool UsePostInc,
Loop *L,
1005 "Computed iteration count is not loop invariant!");
1032 if (isa<SCEVConstant>(IVInit) && isa<SCEVConstant>(ExitCount))
1045 "Computed iteration count is not loop invariant!");
1052 return Rewriter.expandCodeFor(IVLimit, LimitTy, BI);
1061bool IndVarSimplify::
1063 const SCEV *ExitCount,
1071 Value *CmpIndVar = IndVar;
1072 bool UsePostInc =
false;
1082 bool SafeToPostInc =
1086 if (SafeToPostInc) {
1104 if (
auto *BO = dyn_cast<BinaryOperator>(IncVar)) {
1105 const SCEVAddRecExpr *AR = cast<SCEVAddRecExpr>(SE->getSCEV(IncVar));
1106 if (BO->hasNoUnsignedWrap())
1108 if (BO->hasNoSignedWrap())
1113 IndVar, ExitingBB, ExitCount, UsePostInc, L, Rewriter, SE);
1116 "genLoopLimit missed a cast");
1122 P = ICmpInst::ICMP_NE;
1124 P = ICmpInst::ICMP_EQ;
1131 Builder.SetCurrentDebugLocation(
Cond->getDebugLoc());
1138 unsigned CmpIndVarSize = SE->getTypeSizeInBits(CmpIndVar->
getType());
1139 unsigned ExitCntSize = SE->getTypeSizeInBits(ExitCnt->
getType());
1140 if (CmpIndVarSize > ExitCntSize) {
1150 const SCEV *
IV = SE->getSCEV(CmpIndVar);
1151 const SCEV *TruncatedIV = SE->getTruncateExpr(SE->getSCEV(CmpIndVar),
1153 const SCEV *ZExtTrunc =
1154 SE->getZeroExtendExpr(TruncatedIV, CmpIndVar->
getType());
1156 if (ZExtTrunc ==
IV) {
1161 const SCEV *SExtTrunc =
1162 SE->getSignExtendExpr(TruncatedIV, CmpIndVar->
getType());
1163 if (SExtTrunc ==
IV) {
1177 LLVM_DEBUG(
dbgs() <<
"INDVARS: Rewriting loop exit condition to:\n"
1178 <<
" LHS:" << *CmpIndVar <<
'\n'
1179 <<
" op:\t" << (
P == ICmpInst::ICMP_NE ?
"!=" :
"==")
1181 <<
" RHS:\t" << *ExitCnt <<
"\n"
1182 <<
"ExitCount:\t" << *ExitCount <<
"\n"
1193 DeadInsts.emplace_back(OrigCond);
1206bool IndVarSimplify::sinkUnusedInvariants(
Loop *L) {
1208 if (!ExitBlock)
return false;
1211 if (!Preheader)
return false;
1213 bool MadeAnyChanges =
false;
1216 while (
I != Preheader->
begin()) {
1219 if (isa<PHINode>(
I))
1228 if (
I->mayHaveSideEffects() ||
I->mayReadFromMemory())
1232 if (isa<DbgInfoIntrinsic>(
I))
1243 if (isa<AllocaInst>(
I))
1248 bool UsedInLoop =
false;
1249 for (
Use &U :
I->uses()) {
1255 UseBB =
P->getIncomingBlock(i);
1257 if (UseBB == Preheader || L->
contains(UseBB)) {
1271 if (
I != Preheader->
begin()) {
1275 }
while (
I->isDebugOrPseudoInst() &&
I != Preheader->
begin());
1277 if (
I->isDebugOrPseudoInst() &&
I == Preheader->
begin())
1283 MadeAnyChanges =
true;
1285 SE->forgetValue(ToMove);
1290 return MadeAnyChanges;
1296 LLVM_DEBUG(
dbgs() <<
"Replacing condition of loop-exiting branch " << *BI
1297 <<
" with " << *NewCond <<
"\n");
1299 if (OldCond->use_empty())
1309 IsTaken ? ExitIfTrue : !ExitIfTrue);
1326 for (
auto &PN : LoopHeader->phis()) {
1329 Worklist.
push_back(cast<Instruction>(U));
1338 while (!Worklist.
empty()) {
1340 if (!Visited.
insert(
I).second)
1349 for (
User *U :
I->users())
1350 Worklist.
push_back(cast<Instruction>(U));
1351 I->replaceAllUsesWith(Res);
1363 assert(Preheader &&
"Preheader doesn't exist");
1369 InvariantPred = ICmpInst::getInversePredicate(InvariantPred);
1372 return Builder.CreateICmp(InvariantPred, LHSV, RHSV,
1376static std::optional<Value *>
1378 const SCEV *MaxIter,
bool Inverted,
bool SkipLastIter,
1396 auto *MaxIterTy = MaxIter->
getType();
1413 if (
auto *
UMin = dyn_cast<SCEVUMinExpr>(MaxIter)) {
1414 for (
auto *Op :
UMin->operands())
1425 return std::nullopt;
1440 "Not a loop exit!");
1453 auto GoThrough = [&](
Value *V) {
1474 if (!GoThrough(Curr))
1475 if (
auto *ICmp = dyn_cast<ICmpInst>(Curr))
1477 }
while (!Worklist.
empty());
1484 if (!SkipLastIter && LeafConditions.
size() > 1 &&
1486 ScalarEvolution::ExitCountKind::SymbolicMaximum) ==
1488 for (
auto *ICmp : LeafConditions) {
1492 if (isa<SCEVCouldNotCompute>(ExitMax))
1500 if (WideExitMax == WideMaxIter)
1501 ICmpsFailingOnLastIter.
insert(ICmp);
1504 bool Changed =
false;
1505 for (
auto *OldCond : LeafConditions) {
1510 bool OptimisticSkipLastIter = SkipLastIter;
1511 if (!OptimisticSkipLastIter) {
1512 if (ICmpsFailingOnLastIter.
size() > 1)
1513 OptimisticSkipLastIter =
true;
1514 else if (ICmpsFailingOnLastIter.
size() == 1)
1515 OptimisticSkipLastIter = !ICmpsFailingOnLastIter.
count(OldCond);
1519 OptimisticSkipLastIter, SE,
Rewriter)) {
1521 auto *NewCond = *Replaced;
1522 if (
auto *NCI = dyn_cast<Instruction>(NewCond)) {
1523 NCI->setName(OldCond->
getName() +
".first_iter");
1525 LLVM_DEBUG(
dbgs() <<
"Unknown exit count: Replacing " << *OldCond
1526 <<
" with " << *NewCond <<
"\n");
1532 ICmpsFailingOnLastIter.
erase(OldCond);
1538bool IndVarSimplify::canonicalizeExitCondition(
Loop *L) {
1550 bool Changed =
false;
1551 for (
auto *ExitingBB : ExitingBlocks) {
1552 auto *BI = dyn_cast<BranchInst>(ExitingBB->
getTerminator());
1558 if (!ICmp || !ICmp->hasOneUse())
1561 auto *
LHS = ICmp->getOperand(0);
1562 auto *
RHS = ICmp->getOperand(1);
1574 Value *LHSOp =
nullptr;
1579 const unsigned InnerBitWidth =
DL.getTypeSizeInBits(LHSOp->
getType());
1580 const unsigned OuterBitWidth =
DL.getTypeSizeInBits(
RHS->
getType());
1581 auto FullCR = ConstantRange::getFull(InnerBitWidth);
1582 FullCR = FullCR.zeroExtend(OuterBitWidth);
1583 auto RHSCR = SE->getUnsignedRange(SE->applyLoopGuards(SE->getSCEV(RHS), L));
1584 if (FullCR.contains(RHSCR)) {
1587 ICmp->setPredicate(ICmp->getUnsignedPredicate());
1597 for (
auto *ExitingBB : ExitingBlocks) {
1598 auto *BI = dyn_cast<BranchInst>(ExitingBB->
getTerminator());
1604 if (!ICmp || !ICmp->hasOneUse() || !ICmp->isUnsigned())
1607 bool Swapped =
false;
1608 auto *
LHS = ICmp->getOperand(0);
1609 auto *
RHS = ICmp->getOperand(1);
1624 Value *LHSOp =
nullptr;
1634 if (!
LHS->
hasOneUse() && !isa<SCEVAddRecExpr>(SE->getSCEV(LHSOp)))
1641 auto doRotateTransform = [&]() {
1642 assert(ICmp->isUnsigned() &&
"must have proven unsigned already");
1646 ICmp->setOperand(Swapped ? 1 : 0, LHSOp);
1647 ICmp->setOperand(Swapped ? 0 : 1, NewRHS);
1649 DeadInsts.push_back(LHS);
1654 const unsigned InnerBitWidth =
DL.getTypeSizeInBits(LHSOp->
getType());
1655 const unsigned OuterBitWidth =
DL.getTypeSizeInBits(
RHS->
getType());
1656 auto FullCR = ConstantRange::getFull(InnerBitWidth);
1657 FullCR = FullCR.zeroExtend(OuterBitWidth);
1658 auto RHSCR = SE->getUnsignedRange(SE->applyLoopGuards(SE->getSCEV(RHS), L));
1659 if (FullCR.contains(RHSCR)) {
1660 doRotateTransform();
1698 if (!L->contains(BI->getSuccessor(CI->isNullValue())))
1699 replaceLoopPHINodesWithPreheaderValues(LI, L, DeadInsts, *SE);
1706 if (ExitingBlocks.
empty())
1710 const SCEV *MaxBECount = SE->getSymbolicMaxBackedgeTakenCount(L);
1711 if (isa<SCEVCouldNotCompute>(MaxBECount))
1720 if (
A ==
B)
return false;
1721 if (DT->properlyDominates(
A,
B))
1724 assert(DT->properlyDominates(B, A) &&
1725 "expected total dominance order!");
1730 for (
unsigned i = 1; i < ExitingBlocks.
size(); i++) {
1731 assert(DT->dominates(ExitingBlocks[i-1], ExitingBlocks[i]));
1735 bool Changed =
false;
1736 bool SkipLastIter =
false;
1737 const SCEV *CurrMaxExit = SE->getCouldNotCompute();
1738 auto UpdateSkipLastIter = [&](
const SCEV *MaxExitCount) {
1739 if (SkipLastIter || isa<SCEVCouldNotCompute>(MaxExitCount))
1741 if (isa<SCEVCouldNotCompute>(CurrMaxExit))
1742 CurrMaxExit = MaxExitCount;
1744 CurrMaxExit = SE->getUMinFromMismatchedTypes(CurrMaxExit, MaxExitCount);
1747 if (CurrMaxExit == MaxBECount)
1748 SkipLastIter =
true;
1751 for (
BasicBlock *ExitingBB : ExitingBlocks) {
1752 const SCEV *ExactExitCount = SE->getExitCount(L, ExitingBB);
1753 const SCEV *MaxExitCount = SE->getExitCount(
1754 L, ExitingBB, ScalarEvolution::ExitCountKind::SymbolicMaximum);
1755 if (isa<SCEVCouldNotCompute>(ExactExitCount)) {
1759 auto OptimizeCond = [&](
bool SkipLastIter) {
1761 MaxBECount, SkipLastIter,
1762 SE, Rewriter, DeadInsts);
1781 if (OptimizeCond(
false))
1783 else if (SkipLastIter && OptimizeCond(
true))
1785 UpdateSkipLastIter(MaxExitCount);
1789 UpdateSkipLastIter(ExactExitCount);
1796 if (ExactExitCount->
isZero()) {
1797 foldExit(L, ExitingBB,
true, DeadInsts);
1805 "Exit counts must be integers");
1808 SE->getWiderType(MaxBECount->
getType(), ExactExitCount->
getType());
1809 ExactExitCount = SE->getNoopOrZeroExtend(ExactExitCount, WiderType);
1810 MaxBECount = SE->getNoopOrZeroExtend(MaxBECount, WiderType);
1817 foldExit(L, ExitingBB,
false, DeadInsts);
1826 if (!DominatingExactExitCounts.
insert(ExactExitCount).second) {
1827 foldExit(L, ExitingBB,
false, DeadInsts);
1861 const SCEV *ExactBTC = SE->getBackedgeTakenCount(L);
1862 if (isa<SCEVCouldNotCompute>(ExactBTC) || !
Rewriter.isSafeToExpand(ExactBTC))
1865 assert(SE->isLoopInvariant(ExactBTC, L) &&
"BTC must be loop invariant");
1889 if (!ExitBlock->
phis().empty())
1892 const SCEV *ExitCount = SE->getExitCount(L, ExitingBB);
1893 if (isa<SCEVCouldNotCompute>(ExitCount) ||
1894 !
Rewriter.isSafeToExpand(ExitCount))
1897 assert(SE->isLoopInvariant(ExitCount, L) &&
1898 "Exit count must be loop invariant");
1915 if (DT->properlyDominates(
A,
B))
return true;
1916 if (DT->properlyDominates(
B,
A))
return false;
1917 return A->getName() <
B->getName();
1922 for (
unsigned i = 1; i < ExitingBlocks.
size(); i++)
1923 if (!DT->dominates(ExitingBlocks[i-1], ExitingBlocks[i]))
1928 for (
unsigned i = 0, e = ExitingBlocks.
size(); i < e; i++)
1929 if (BadExit(ExitingBlocks[i])) {
1934 if (ExitingBlocks.
empty())
1956 if (
I.mayHaveSideEffects())
1959 bool Changed =
false;
1972 Value *ExactBTCV =
nullptr;
1973 for (
BasicBlock *ExitingBB : ExitingBlocks) {
1974 const SCEV *ExitCount = SE->getExitCount(L, ExitingBB);
1978 if (ExitCount == ExactBTC) {
1980 B.getFalse() :
B.getTrue();
1984 ExactBTCV =
Rewriter.expandCodeFor(ExactBTC);
1988 ECV =
B.CreateZExt(ECV, WiderTy);
1989 RHS =
B.CreateZExt(RHS, WiderTy);
1992 ICmpInst::ICMP_NE : ICmpInst::ICMP_EQ;
1993 NewCond =
B.CreateICmp(Pred, ECV, RHS);
1998 DeadInsts.emplace_back(OldCond);
2009bool IndVarSimplify::run(
Loop *L) {
2012 "LCSSA required to run indvars!");
2031 const SCEV *BackedgeTakenCount;
2033 BackedgeTakenCount = SE->getBackedgeTakenCount(L);
2036 bool Changed =
false;
2039 Changed |= rewriteNonIntegerIVs(L);
2054 Changed |= simplifyAndExtend(L, Rewriter, LI);
2063 NumReplaced += Rewrites;
2069 NumElimIV +=
Rewriter.replaceCongruentIVs(L, DT, DeadInsts,
TTI);
2073 Changed |= canonicalizeExitCondition(L);
2076 if (optimizeLoopExits(L, Rewriter)) {
2081 SE->forgetTopmostLoop(L);
2086 if (predicateLoopExits(L, Rewriter)) {
2099 for (
BasicBlock *ExitingBB : ExitingBlocks) {
2113 const SCEV *ExitCount = SE->getExitCount(L, ExitingBB);
2114 if (isa<SCEVCouldNotCompute>(ExitCount))
2145 Changed |= linearFunctionTestReplace(L, ExitingBB,
2157 while (!DeadInsts.empty()) {
2158 Value *V = DeadInsts.pop_back_val();
2160 if (
PHINode *
PHI = dyn_cast_or_null<PHINode>(V))
2162 else if (
Instruction *Inst = dyn_cast_or_null<Instruction>(V))
2171 Changed |= sinkUnusedInvariants(L);
2176 Changed |= rewriteFirstIterationLoopExitValues(L);
2183 "Indvars did not preserve LCSSA!");
2189 if (
VerifyIndvars && !isa<SCEVCouldNotCompute>(BackedgeTakenCount)) {
2191 const SCEV *NewBECount = SE->getBackedgeTakenCount(L);
2192 if (SE->getTypeSizeInBits(BackedgeTakenCount->
getType()) <
2193 SE->getTypeSizeInBits(NewBECount->
getType()))
2194 NewBECount = SE->getTruncateOrNoop(NewBECount,
2195 BackedgeTakenCount->
getType());
2197 BackedgeTakenCount = SE->getTruncateOrNoop(BackedgeTakenCount,
2199 assert(!SE->isKnownPredicate(ICmpInst::ICMP_ULT, BackedgeTakenCount,
2200 NewBECount) &&
"indvars must preserve SCEV");
2203 MSSAU->getMemorySSA()->verifyMemorySSA();
2229struct IndVarSimplifyLegacyPass :
public LoopPass {
2240 auto *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
2241 auto *SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
2242 auto *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
2243 auto *TLIP = getAnalysisIfAvailable<TargetLibraryInfoWrapperPass>();
2245 auto *TTIP = getAnalysisIfAvailable<TargetTransformInfoWrapperPass>();
2248 auto *MSSAAnalysis = getAnalysisIfAvailable<MemorySSAWrapperPass>();
2251 MSSA = &MSSAAnalysis->getMSSA();
2266char IndVarSimplifyLegacyPass::ID = 0;
2269 "Induction Variable Simplification",
false,
false)
2275 return new IndVarSimplifyLegacyPass();
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file declares a class to represent arbitrary precision floating point values and provide a varie...
SmallVector< MachineOperand, 4 > Cond
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
static Value * genLoopLimit(PHINode *IndVar, BasicBlock *ExitingBB, const SCEV *ExitCount, bool UsePostInc, Loop *L, SCEVExpander &Rewriter, ScalarEvolution *SE)
Insert an IR expression which computes the value held by the IV IndVar (which must be an loop counter...
static void replaceExitCond(BranchInst *BI, Value *NewCond, SmallVectorImpl< WeakTrackingVH > &DeadInsts)
static cl::opt< bool > DisableLFTR("disable-lftr", cl::Hidden, cl::init(false), cl::desc("Disable Linear Function Test Replace optimization"))
static bool isLoopExitTestBasedOn(Value *V, BasicBlock *ExitingBB)
Whether the current loop exit test is based on this value.
static bool mustExecuteUBIfPoisonOnPathTo(Instruction *Root, Instruction *OnPathTo, DominatorTree *DT)
Return true if undefined behavior would provable be executed on the path to OnPathTo if Root produced...
static cl::opt< ReplaceExitVal > ReplaceExitValue("replexitval", cl::Hidden, cl::init(OnlyCheapRepl), cl::desc("Choose the strategy to replace exit value in IndVarSimplify"), cl::values(clEnumValN(NeverRepl, "never", "never replace exit value"), clEnumValN(OnlyCheapRepl, "cheap", "only replace exit value when the cost is cheap"), clEnumValN(UnusedIndVarInLoop, "unusedindvarinloop", "only replace exit value when it is an unused " "induction variable in the loop and has cheap replacement cost"), clEnumValN(NoHardUse, "noharduse", "only replace exit values when loop def likely dead"), clEnumValN(AlwaysRepl, "always", "always replace exit value whenever possible")))
static cl::opt< bool > VerifyIndvars("verify-indvars", cl::Hidden, cl::desc("Verify the ScalarEvolution result after running indvars. Has no " "effect in release builds. (Note: this adds additional SCEV " "queries potentially changing the analysis result)"))
static void visitIVCast(CastInst *Cast, WideIVInfo &WI, ScalarEvolution *SE, const TargetTransformInfo *TTI)
Update information about the induction variable that is extended by this sign or zero extend operatio...
static void replaceLoopPHINodesWithPreheaderValues(LoopInfo *LI, Loop *L, SmallVectorImpl< WeakTrackingVH > &DeadInsts, ScalarEvolution &SE)
static bool needsLFTR(Loop *L, BasicBlock *ExitingBB)
linearFunctionTestReplace policy.
static bool optimizeLoopExitWithUnknownExitCount(const Loop *L, BranchInst *BI, BasicBlock *ExitingBB, const SCEV *MaxIter, bool SkipLastIter, ScalarEvolution *SE, SCEVExpander &Rewriter, SmallVectorImpl< WeakTrackingVH > &DeadInsts)
static Value * createInvariantCond(const Loop *L, BasicBlock *ExitingBB, const ScalarEvolution::LoopInvariantPredicate &LIP, SCEVExpander &Rewriter)
static bool isLoopCounter(PHINode *Phi, Loop *L, ScalarEvolution *SE)
Return true if the given phi is a "counter" in L.
static std::optional< Value * > createReplacement(ICmpInst *ICmp, const Loop *L, BasicBlock *ExitingBB, const SCEV *MaxIter, bool Inverted, bool SkipLastIter, ScalarEvolution *SE, SCEVExpander &Rewriter)
static bool AlmostDeadIV(PHINode *Phi, BasicBlock *LatchBlock, Value *Cond)
Return true if this IV has any uses other than the (soon to be rewritten) loop exit test.
static bool hasConcreteDefImpl(Value *V, SmallPtrSetImpl< Value * > &Visited, unsigned Depth)
Recursive helper for hasConcreteDef().
static bool hasConcreteDef(Value *V)
Return true if the given value is concrete.
static void foldExit(const Loop *L, BasicBlock *ExitingBB, bool IsTaken, SmallVectorImpl< WeakTrackingVH > &DeadInsts)
Induction Variable Simplification
static PHINode * getLoopPhiForCounter(Value *IncV, Loop *L)
Given an Value which is hoped to be part of an add recurance in the given loop, return the associated...
static Constant * createFoldedExitCond(const Loop *L, BasicBlock *ExitingBB, bool IsTaken)
static cl::opt< bool > UsePostIncrementRanges("indvars-post-increment-ranges", cl::Hidden, cl::desc("Use post increment control-dependent ranges in IndVarSimplify"), cl::init(true))
static PHINode * FindLoopCounter(Loop *L, BasicBlock *ExitingBB, const SCEV *BECount, ScalarEvolution *SE, DominatorTree *DT)
Search the loop header for a loop counter (anadd rec w/step of one) suitable for use by LFTR.
static cl::opt< bool > AllowIVWidening("indvars-widen-indvars", cl::Hidden, cl::init(true), cl::desc("Allow widening of indvars to eliminate s/zext"))
static bool ConvertToSInt(const APFloat &APF, int64_t &IntVal)
Convert APF to an integer, if possible.
static cl::opt< bool > LoopPredication("indvars-predicate-loops", cl::Hidden, cl::init(true), cl::desc("Predicate conditions in read only loops"))
This file exposes an interface to building/using memory SSA to walk memory instructions using a use/d...
Module.h This file contains the declarations for the Module class.
This header defines various interfaces for pass management in LLVM.
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallPtrSet class.
This file defines the SmallSet class.
This file defines the SmallVector class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
This defines the Use class.
Virtual Register Rewriter
static const uint32_t IV[8]
opStatus convertToInteger(MutableArrayRef< integerPart > Input, unsigned int Width, bool IsSigned, roundingMode RM, bool *IsExact) const
A container for analyses that lazily runs them and caches their results.
Represent the analysis usage information of a pass.
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
LLVM Basic Block Representation.
iterator begin()
Instruction iterator methods.
iterator_range< const_phi_iterator > phis() const
Returns a range that iterates over the phis in the basic block.
const_iterator getFirstInsertionPt() const
Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI i...
const Function * getParent() const
Return the enclosing method, or null if none.
InstListType::iterator iterator
Instruction iterators...
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 Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr if the function does no...
Conditional or Unconditional Branch instruction.
void setCondition(Value *V)
bool isConditional() const
BasicBlock * getSuccessor(unsigned i) const
Value * getCondition() const
Represents analyses that only rely on functions' control flow.
This is the base class for all instructions that perform data casts.
Instruction::CastOps getOpcode() const
Return the opcode of this CastInst.
static CastInst * Create(Instruction::CastOps, Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Provides a way to construct any of the CastInst subclasses using an opcode instead of the subclass's ...
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
@ FCMP_OEQ
0 0 0 1 True if ordered and equal
@ ICMP_SLT
signed less than
@ ICMP_SLE
signed less or equal
@ FCMP_OLT
0 1 0 0 True if ordered and less than
@ FCMP_ULE
1 1 0 1 True if unordered, less than, or equal
@ FCMP_OGT
0 0 1 0 True if ordered and greater than
@ FCMP_OGE
0 0 1 1 True if ordered and greater than or equal
@ ICMP_SGT
signed greater than
@ FCMP_ULT
1 1 0 0 True if unordered or less than
@ FCMP_ONE
0 1 1 0 True if ordered and operands are unequal
@ FCMP_UEQ
1 0 0 1 True if unordered or equal
@ ICMP_ULT
unsigned less than
@ FCMP_UGT
1 0 1 0 True if unordered or greater than
@ FCMP_OLE
0 1 0 1 True if ordered and less than or equal
@ ICMP_SGE
signed greater or equal
@ FCMP_UNE
1 1 1 0 True if unordered or not equal
@ FCMP_UGE
1 0 1 1 True if unordered, greater than, or equal
Predicate getInversePredicate() const
For example, EQ -> NE, UGT -> ULE, SLT -> SGE, OEQ -> UNE, UGT -> OLE, OLT -> UGE,...
Predicate getPredicate() const
Return the predicate for this instruction.
ConstantFP - Floating Point Values [float, double].
const APFloat & getValueAPF() 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.
This is an important base class in LLVM.
A parsed version of the target data layout string in and methods for querying it.
bool isLegalInteger(uint64_t Width) const
Returns true if the specified type is known to be a native integer type supported by the CPU.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
bool dominates(const BasicBlock *BB, const Use &U) const
Return true if the (end of the) basic block BB dominates the use U.
This instruction compares its operands according to the predicate given to the constructor.
This instruction compares its operands according to the predicate given to the constructor.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Interface for visiting interesting IV users that are recognized but not simplified by this utility.
virtual void visitCast(CastInst *Cast)=0
PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM, LoopStandardAnalysisResults &AR, LPMUpdater &U)
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
const BasicBlock * getParent() const
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
void moveBefore(Instruction *MovePos)
Unlink this instruction from its current basic block and insert it into the basic block that MovePos ...
Class to represent integer types.
This class provides an interface for updating the loop pass manager based on mutations to the loop ne...
bool contains(const LoopT *L) const
Return true if the specified loop is contained within in this loop.
BlockT * getLoopLatch() const
If there is a single latch block for this loop, return it.
void getExitingBlocks(SmallVectorImpl< BlockT * > &ExitingBlocks) const
Return all blocks inside the loop that have successors outside of the loop.
BlockT * getHeader() const
iterator_range< block_iterator > blocks() const
BlockT * getExitBlock() const
If getExitBlocks would return exactly one block, return that block.
BlockT * getLoopPreheader() const
If there is a preheader for this loop, return it.
ArrayRef< BlockT * > getBlocks() const
Get a list of the basic blocks which make up this loop.
void getUniqueExitBlocks(SmallVectorImpl< BlockT * > &ExitBlocks) const
Return all unique successor blocks of 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.
bool isLCSSAForm(const DominatorTree &DT, bool IgnoreTokens=true) const
Return true if the Loop is in LCSSA form.
bool isLoopInvariant(const Value *V) const
Return true if the specified value is loop invariant.
bool isLoopSimplifyForm() const
Return true if the Loop is in the form that the LoopSimplify form transforms loops to,...
bool isRecursivelyLCSSAForm(const DominatorTree &DT, const LoopInfo &LI, bool IgnoreTokens=true) const
Return true if this Loop and all inner subloops are in LCSSA form.
bool makeLoopInvariant(Value *V, bool &Changed, Instruction *InsertPt=nullptr, MemorySSAUpdater *MSSAU=nullptr, ScalarEvolution *SE=nullptr) const
If the given value is an instruction inside of the loop and it can be hoisted, do so to make it trivi...
An analysis that produces MemorySSA for a function.
Legacy analysis pass which computes MemorySSA.
Encapsulates MemorySSA, including all data associated with memory accesses.
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
void setIncomingValue(unsigned i, Value *V)
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...
Value * getIncomingValueForBlock(const BasicBlock *BB) const
BasicBlock * getIncomingBlock(unsigned i) const
Return incoming basic block number i.
Value * getIncomingValue(unsigned i) const
Return incoming value number x.
static unsigned getIncomingValueNumForOperand(unsigned i)
int getBasicBlockIndex(const BasicBlock *BB) const
Return the first index of the specified basic block in the value list for this PHI.
unsigned getNumIncomingValues() const
Return the number of incoming edges.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Pass interface - Implemented by all 'passes'.
static PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
This node represents a polynomial recurrence on the trip count of the specified loop.
const SCEV * getStart() const
const SCEV * getStepRecurrence(ScalarEvolution &SE) const
Constructs and returns the recurrence indicating how much this expression steps by.
bool isAffine() const
Return true if this represents an expression A + B*x where A and B are loop invariant values.
const Loop * getLoop() const
This class uses information about analyze scalars to rewrite expressions in canonical form.
bool hasNoUnsignedWrap() const
bool hasNoSignedWrap() const
This class represents an analyzed expression in the program.
bool isOne() const
Return true if the expression is a constant one.
bool isZero() const
Return true if the expression is a constant zero.
Type * getType() const
Return the LLVM type of this SCEV expression.
This class represents a cast from signed integer to floating point.
The main scalar evolution driver.
Type * getWiderType(Type *Ty1, Type *Ty2) const
const SCEV * getSCEVAtScope(const SCEV *S, const Loop *L)
Return a SCEV expression for the specified value at the specified scope in the program.
uint64_t getTypeSizeInBits(Type *Ty) const
Return the size in bits of the specified type, for which isSCEVable must return true.
const SCEV * getSCEV(Value *V)
Return a SCEV expression for the full generality of the specified expression.
const SCEV * getOne(Type *Ty)
Return a SCEV for the constant 1 of a specific type.
bool isKnownPredicateAt(ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS, const Instruction *CtxI)
Test if the given expression is known to satisfy the condition described by Pred, LHS,...
bool isLoopInvariant(const SCEV *S, const Loop *L)
Return true if the value of the given SCEV is unchanging in the specified loop.
const SCEV * getZeroExtendExpr(const SCEV *Op, Type *Ty, unsigned Depth=0)
bool isSCEVable(Type *Ty) const
Test if values of the given type are analyzable within the SCEV framework.
Type * getEffectiveSCEVType(Type *Ty) const
Return a type with the same bitwidth as the given type and which represents how SCEV will treat the g...
std::optional< bool > evaluatePredicateAt(ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS, const Instruction *CtxI)
Check whether the condition described by Pred, LHS, and RHS is true or false in the given Context.
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...
const SCEV * getTruncateExpr(const SCEV *Op, Type *Ty, unsigned Depth=0)
const SCEV * getMinusSCEV(const SCEV *LHS, const SCEV *RHS, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap, unsigned Depth=0)
Return LHS-RHS.
const SCEV * getMinusOne(Type *Ty)
Return a SCEV for the constant -1 of a specific type.
const SCEV * getNoopOrZeroExtend(const SCEV *V, Type *Ty)
Return a SCEV corresponding to a conversion of the input value to the specified type.
const SCEV * getUMinFromMismatchedTypes(const SCEV *LHS, const SCEV *RHS, bool Sequential=false)
Promote the operands to the wider of the types using zero-extension, and then perform a umin operatio...
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...
ExitLimit computeExitLimitFromCond(const Loop *L, Value *ExitCond, bool ExitIfTrue, bool ControlsExit, bool AllowPredicates=false)
Compute the number of times the backedge of the specified loop will execute if its exit condition wer...
std::optional< LoopInvariantPredicate > getLoopInvariantExitCondDuringFirstIterations(ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS, const Loop *L, const Instruction *CtxI, const SCEV *MaxIter)
If the result of the predicate LHS Pred RHS is loop invariant with respect to L at given Context duri...
const SCEV * getTruncateOrZeroExtend(const SCEV *V, Type *Ty, unsigned Depth=0)
Return a SCEV corresponding to a conversion of the input value to the specified type.
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.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
bool erase(PtrType Ptr)
erase - If the set contains the specified pointer, remove it and return true, otherwise return false.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
reference emplace_back(ArgTypes &&... Args)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Provides information about what library functions are available for the current target.
The instances of the Type class are immutable: once they are created, they are never changed.
bool isPointerTy() const
True if this is an instance of PointerType.
static IntegerType * getInt32Ty(LLVMContext &C)
bool isIntegerTy() const
True if this is an instance of IntegerType.
A Use represents the edge between a Value definition and its users.
Value * getOperand(unsigned i) const
unsigned getNumOperands() const
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
bool hasOneUse() const
Return true if there is exactly one use of this value.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
iterator_range< user_iterator > users()
LLVMContext & getContext() const
All values hold a context through their type.
user_iterator_impl< User > user_iterator
StringRef getName() const
Return a constant reference to the value's name.
void takeName(Value *V)
Transfer the name from V to this value.
Value handle that is nullable, but tries to track the Value.
self_iterator getIterator()
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
CastClass_match< OpTy, Instruction::ZExt > m_ZExt(const OpTy &Op)
Matches ZExt.
bool match(Val *V, const Pattern &P)
auto m_LogicalOr()
Matches L || R where L and R are arbitrary values.
class_match< Value > m_Value()
Match an arbitrary value and ignore it.
auto m_LogicalAnd()
Matches L && R where L and R are arbitrary values.
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
initializer< Ty > init(const Ty &Val)
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
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.
PHINode * createWideIV(const WideIVInfo &WI, LoopInfo *LI, ScalarEvolution *SE, SCEVExpander &Rewriter, DominatorTree *DT, SmallVectorImpl< WeakTrackingVH > &DeadInsts, unsigned &NumElimExt, unsigned &NumWidened, bool HasGuards, bool UsePostIncrementRanges)
Widen Induction Variables - Extend the width of an IV to cover its widest uses.
Interval::succ_iterator succ_begin(Interval *I)
succ_begin/succ_end - define methods so that Intervals may be used just like BasicBlocks can with the...
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
bool DeleteDeadPHIs(BasicBlock *BB, const TargetLibraryInfo *TLI=nullptr, MemorySSAUpdater *MSSAU=nullptr)
Examine each PHI in the given block and delete it if it is dead.
void sort(IteratorTy Start, IteratorTy End)
void initializeIndVarSimplifyLegacyPassPass(PassRegistry &)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
cl::opt< unsigned > SCEVCheapExpansionBudget
bool simplifyUsersOfIV(PHINode *CurrIV, ScalarEvolution *SE, DominatorTree *DT, LoopInfo *LI, const TargetTransformInfo *TTI, SmallVectorImpl< WeakTrackingVH > &Dead, SCEVExpander &Rewriter, IVVisitor *V=nullptr)
simplifyUsersOfIV - Simplify instructions that use this induction variable by using ScalarEvolution t...
void getLoopAnalysisUsage(AnalysisUsage &AU)
Helper to consistently add the set of standard passes to a loop pass's AnalysisUsage.
bool mustTriggerUB(const Instruction *I, const SmallSet< const Value *, 16 > &KnownPoison)
Return true if the given instruction must trigger undefined behavior when I is executed with any oper...
bool VerifyMemorySSA
Enables verification of MemorySSA.
Value * simplifyInstruction(Instruction *I, const SimplifyQuery &Q, OptimizationRemarkEmitter *ORE=nullptr)
See if we can compute a simplified version of this instruction.
@ UMin
Unisgned integer min implemented in terms of select(cmp()).
PreservedAnalyses getLoopPassPreservedAnalyses()
Returns the minimum set of Analyses that all loop passes must preserve.
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
int rewriteLoopExitValues(Loop *L, LoopInfo *LI, TargetLibraryInfo *TLI, ScalarEvolution *SE, const TargetTransformInfo *TTI, SCEVExpander &Rewriter, DominatorTree *DT, ReplaceExitVal ReplaceExitValue, SmallVector< WeakTrackingVH, 16 > &DeadInsts)
If the final value of any expressions that are recurrent in the loop can be computed,...
bool RecursivelyDeleteDeadPHINode(PHINode *PN, const TargetLibraryInfo *TLI=nullptr, MemorySSAUpdater *MSSAU=nullptr)
If the specified value is an effectively dead PHI node, due to being a def-use chain of single-use no...
Pass * createIndVarSimplifyPass()
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
The adaptor from a function pass to a loop pass computes these analyses and makes them available to t...
TargetTransformInfo & TTI
const SCEV * SymbolicMaxNotTaken
Collect information about induction variables that are used by sign/zero extend operations.