32using namespace PatternMatch;
34#define LV_NAME "loop-vectorize"
35#define DEBUG_TYPE LV_NAME
39 cl::desc(
"Enable if-conversion during vectorization."));
43 cl::desc(
"Enable recognition of non-constant strided "
44 "pointer induction variables."));
48 cl::desc(
"Allow enabling loop hints to reorder "
49 "FP operations during vectorization."));
55 cl::desc(
"The maximum number of SCEV checks allowed."));
59 cl::desc(
"The maximum number of SCEV checks allowed with a "
60 "vectorize(enable) pragma"));
66 cl::desc(
"Control whether the compiler can use scalable vectors to "
70 "Scalable vectorization is disabled."),
73 "Scalable vectorization is available and favored when the "
74 "cost is inconclusive."),
77 "Scalable vectorization is available and favored when the "
78 "cost is inconclusive.")));
82 cl::desc(
"Enables autovectorization of some loops containing histograms"));
89bool LoopVectorizeHints::Hint::validate(
unsigned Val) {
100 return (Val == 0 || Val == 1);
106 bool InterleaveOnlyWhenForced,
110 Interleave(
"interleave.count", InterleaveOnlyWhenForced, HK_INTERLEAVE),
111 Force(
"vectorize.enable", FK_Undefined, HK_FORCE),
112 IsVectorized(
"isvectorized", 0, HK_ISVECTORIZED),
113 Predicate(
"vectorize.predicate.enable", FK_Undefined, HK_PREDICATE),
114 Scalable(
"vectorize.scalable.enable", SK_Unspecified, HK_SCALABLE),
115 TheLoop(L), ORE(ORE) {
117 getHintsFromMetadata();
151 if (IsVectorized.Value != 1)
158 <<
"LV: Interleaving disabled by the pass manager\n");
171 {
Twine(Prefix(),
"vectorize.").
str(),
172 Twine(Prefix(),
"interleave.").
str()},
177 IsVectorized.Value = 1;
183 LLVM_DEBUG(
dbgs() <<
"LV: Not vectorizing: #pragma vectorize disable.\n");
189 LLVM_DEBUG(
dbgs() <<
"LV: Not vectorizing: No #pragma vectorize enable.\n");
195 LLVM_DEBUG(
dbgs() <<
"LV: Not vectorizing: Disabled/already vectorized.\n");
201 "AllDisabled", L->getStartLoc(),
203 <<
"loop not vectorized: vectorization and interleaving are "
204 "explicitly disabled, or the loop has already been "
221 <<
"loop not vectorized: vectorization is explicitly disabled";
225 R <<
"loop not vectorized";
227 R <<
" (Force=" << NV(
"Force", true);
228 if (Width.Value != 0)
229 R <<
", Vector Width=" << NV(
"VectorWidth", getWidth());
230 if (getInterleave() != 0)
231 R <<
", Interleave Count=" << NV(
"InterleaveCount", getInterleave());
254 EC.getKnownMinValue() > 1);
257void LoopVectorizeHints::getHintsFromMetadata() {
272 if (
const MDNode *MD = dyn_cast<MDNode>(MDO)) {
273 if (!MD || MD->getNumOperands() == 0)
275 S = dyn_cast<MDString>(MD->getOperand(0));
276 for (
unsigned Idx = 1;
Idx < MD->getNumOperands(); ++
Idx)
277 Args.push_back(MD->getOperand(
Idx));
279 S = dyn_cast<MDString>(MDO);
280 assert(Args.size() == 0 &&
"too many arguments for MDString");
288 if (
Args.size() == 1)
289 setHint(
Name, Args[0]);
294 if (!
Name.starts_with(Prefix()))
298 const ConstantInt *
C = mdconst::dyn_extract<ConstantInt>(Arg);
301 unsigned Val =
C->getZExtValue();
303 Hint *Hints[] = {&Width, &Interleave, &Force,
305 for (
auto *
H : Hints) {
306 if (
Name ==
H->Name) {
307 if (
H->validate(Val))
356 auto *LatchBr = dyn_cast<BranchInst>(Latch->
getTerminator());
357 if (!LatchBr || LatchBr->isUnconditional()) {
363 auto *LatchCmp = dyn_cast<CmpInst>(LatchBr->getCondition());
366 dbgs() <<
"LV: Loop latch condition is not a compare instruction.\n");
370 Value *CondOp0 = LatchCmp->getOperand(0);
371 Value *CondOp1 = LatchCmp->getOperand(1);
372 Value *IVUpdate =
IV->getIncomingValueForBlock(Latch);
375 LLVM_DEBUG(
dbgs() <<
"LV: Loop latch condition is not uniform.\n");
389 for (
Loop *SubLp : *Lp)
407 return cast<IntegerType>(Ty);
423 if (!AllowedExit.
count(Inst))
429 LLVM_DEBUG(
dbgs() <<
"LV: Found an outside user for : " << *UI <<
'\n');
444 Value *APtr =
A->getPointerOperand();
445 Value *BPtr =
B->getPointerOperand();
459 const auto &Strides =
465 CanAddPredicate,
false).value_or(0);
466 if (Stride == 1 || Stride == -1)
482class SCEVAddRecForUniformityRewriter
485 unsigned StepMultiplier;
494 bool CannotAnalyze =
false;
496 bool canAnalyze()
const {
return !CannotAnalyze; }
499 SCEVAddRecForUniformityRewriter(
ScalarEvolution &SE,
unsigned StepMultiplier,
500 unsigned Offset,
Loop *TheLoop)
506 "addrec outside of TheLoop must be invariant and should have been "
512 if (!SE.isLoopInvariant(Step, TheLoop)) {
513 CannotAnalyze =
true;
516 const SCEV *NewStep =
517 SE.getMulExpr(Step, SE.getConstant(Ty, StepMultiplier));
518 const SCEV *ScaledOffset = SE.getMulExpr(Step, SE.getConstant(Ty, Offset));
519 const SCEV *NewStart = SE.getAddExpr(Expr->
getStart(), ScaledOffset);
524 if (CannotAnalyze || SE.isLoopInvariant(S, TheLoop))
530 if (SE.isLoopInvariant(S, TheLoop))
533 CannotAnalyze =
true;
539 CannotAnalyze =
true;
544 unsigned StepMultiplier,
unsigned Offset,
551 [](
const SCEV *S) {
return isa<SCEVUDivExpr>(S); }))
554 SCEVAddRecForUniformityRewriter
Rewriter(SE, StepMultiplier, Offset,
576 auto *SE = PSE.
getSE();
584 const SCEV *FirstLaneExpr =
585 SCEVAddRecForUniformityRewriter::rewrite(S, *SE, FixedVF, 0, TheLoop);
586 if (isa<SCEVCouldNotCompute>(FirstLaneExpr))
592 return all_of(
reverse(seq<unsigned>(1, FixedVF)), [&](
unsigned I) {
593 const SCEV *IthLaneExpr =
594 SCEVAddRecForUniformityRewriter::rewrite(S, *SE, FixedVF,
I, TheLoop);
595 return FirstLaneExpr == IthLaneExpr;
611bool LoopVectorizationLegality::canVectorizeOuterLoop() {
621 auto *Br = dyn_cast<BranchInst>(BB->getTerminator());
624 "loop control flow is not understood by vectorizer",
625 "CFGNotUnderstood", ORE, TheLoop);
638 if (Br && Br->isConditional() &&
643 "loop control flow is not understood by vectorizer",
644 "CFGNotUnderstood", ORE, TheLoop);
657 "loop control flow is not understood by vectorizer",
658 "CFGNotUnderstood", ORE, TheLoop);
666 if (!setupOuterLoopInductions()) {
668 "UnsupportedPhi", ORE, TheLoop);
678void LoopVectorizationLegality::addInductionPhi(
681 Inductions[
Phi] =
ID;
695 "Expected int, ptr, or FP induction phi type");
707 ID.getConstIntStepValue() &&
ID.getConstIntStepValue()->isOne() &&
708 isa<Constant>(
ID.getStartValue()) &&
709 cast<Constant>(
ID.getStartValue())->isNullValue()) {
715 if (!PrimaryInduction || PhiTy == WidestIndTy)
716 PrimaryInduction =
Phi;
733bool LoopVectorizationLegality::setupOuterLoopInductions() {
737 auto IsSupportedPhi = [&](
PHINode &
Phi) ->
bool {
741 addInductionPhi(&Phi,
ID, AllowedExit);
747 dbgs() <<
"LV: Found unsupported PHI for outer loop vectorization.\n");
770 TLI.
getWidestVF(ScalarName, WidestFixedVF, WidestScalableVF);
778 "Caller may decide to scalarize a variant using a scalable VF");
786 auto *StructTy = dyn_cast<StructType>(Ty);
790 if (StructTy && !StructTy->containsHomogeneousTypes())
795bool LoopVectorizationLegality::canVectorizeInstrs() {
803 Result &= canVectorizeInstr(
I);
804 if (!DoExtraAnalysis && !Result)
809 if (!PrimaryInduction) {
810 if (Inductions.
empty()) {
812 "Did not find one integer induction var",
813 "loop induction variable could not be identified",
814 "NoInductionVariable", ORE, TheLoop);
819 "Did not find one integer induction var",
820 "integer loop induction variable could not be identified",
821 "NoIntegerInductionVariable", ORE, TheLoop);
824 LLVM_DEBUG(
dbgs() <<
"LV: Did not find one integer induction var.\n");
830 if (PrimaryInduction && WidestIndTy != PrimaryInduction->
getType())
831 PrimaryInduction =
nullptr;
836bool LoopVectorizationLegality::canVectorizeInstr(
Instruction &
I) {
840 if (
auto *Phi = dyn_cast<PHINode>(&
I)) {
846 "Found a non-int non-pointer PHI",
847 "loop control flow is not understood by vectorizer",
848 "CFGNotUnderstood", ORE, TheLoop);
866 if (
Phi->getNumIncomingValues() != 2) {
868 "Found an invalid PHI",
869 "loop control flow is not understood by vectorizer",
870 "CFGNotUnderstood", ORE, TheLoop, Phi);
879 Reductions[
Phi] = RedDes;
887 auto IsDisallowedStridedPointerInduction =
892 ID.getConstIntStepValue() ==
nullptr;
911 !IsDisallowedStridedPointerInduction(
ID)) {
912 addInductionPhi(Phi,
ID, AllowedExit);
919 FixedOrderRecurrences.
insert(Phi);
926 !IsDisallowedStridedPointerInduction(
ID)) {
927 addInductionPhi(Phi,
ID, AllowedExit);
932 "value that could not be identified as "
933 "reduction is used outside the loop",
934 "NonReductionValueUsedOutsideLoop", ORE, TheLoop,
942 auto *CI = dyn_cast<CallInst>(&
I);
945 !(CI->getCalledFunction() && TLI &&
951 TLI && CI->getCalledFunction() && CI->getType()->isFloatingPointTy() &&
952 TLI->
getLibFunc(CI->getCalledFunction()->getName(), Func) &&
961 "Found a non-intrinsic callsite",
962 "library call cannot be vectorized. "
963 "Try compiling with -fno-math-errno, -ffast-math, "
965 "CantVectorizeLibcall", ORE, TheLoop, CI);
968 "call instruction cannot be vectorized",
969 "CantVectorizeLibcall", ORE, TheLoop, CI);
977 auto *SE = PSE.
getSE();
979 for (
unsigned Idx = 0;
Idx < CI->arg_size(); ++
Idx)
983 "Found unvectorizable intrinsic",
984 "intrinsic instruction cannot be vectorized",
985 "CantVectorizeIntrinsic", ORE, TheLoop, CI);
994 VecCallVariantsFound =
true;
996 auto CanWidenInstructionTy = [](
Instruction const &Inst) {
997 Type *InstTy = Inst.getType();
998 if (!isa<StructType>(InstTy))
1005 all_of(Inst.users(), IsaPred<ExtractValueInst>);
1011 if (!CanWidenInstructionTy(
I) ||
1012 (isa<CastInst>(
I) &&
1014 isa<ExtractElementInst>(
I)) {
1016 "instruction return type cannot be vectorized",
1017 "CantVectorizeInstructionReturnType", ORE,
1023 if (
auto *ST = dyn_cast<StoreInst>(&
I)) {
1024 Type *
T =
ST->getValueOperand()->getType();
1027 "CantVectorizeStore", ORE, TheLoop, ST);
1033 if (
ST->getMetadata(LLVMContext::MD_nontemporal)) {
1036 assert(VecTy &&
"did not find vectorized version of stored type");
1039 "nontemporal store instruction cannot be vectorized",
1040 "CantVectorizeNontemporalStore", ORE, TheLoop, ST);
1045 }
else if (
auto *LD = dyn_cast<LoadInst>(&
I)) {
1046 if (
LD->getMetadata(LLVMContext::MD_nontemporal)) {
1050 assert(VecTy &&
"did not find vectorized version of load type");
1053 "nontemporal load instruction cannot be vectorized",
1054 "CantVectorizeNontemporalLoad", ORE, TheLoop, LD);
1064 }
else if (
I.getType()->isFloatingPointTy() && (CI ||
I.isBinaryOp()) &&
1067 Hints->setPotentiallyUnsafe();
1082 "ValueUsedOutsideLoop", ORE, TheLoop, &
I);
1116 Value *HIncVal =
nullptr;
1131 Value *HIdx =
nullptr;
1132 for (
Value *Index :
GEP->indices()) {
1135 if (!isa<ConstantInt>(Index))
1154 const auto *AR = dyn_cast<SCEVAddRecExpr>(PSE.
getSE()->
getSCEV(VPtrVal));
1155 if (!AR || AR->getLoop() != TheLoop)
1165 LLVM_DEBUG(
dbgs() <<
"LV: Found histogram for: " << *HSt <<
"\n");
1172bool LoopVectorizationLegality::canVectorizeIndirectUnsafeDependences() {
1212 LLVM_DEBUG(
dbgs() <<
"LV: Checking for a histogram on: " << *SI <<
"\n");
1216bool LoopVectorizationLegality::canVectorizeMemory() {
1217 LAI = &LAIs.
getInfo(*TheLoop);
1222 "loop not vectorized: ", *LAR);
1227 return canVectorizeIndirectUnsafeDependences();
1231 "write to a loop invariant address could not "
1233 "CantVectorizeStoreToLoopInvariantAddress", ORE,
1251 "We don't allow storing to uniform addresses",
1252 "write of conditional recurring variant value to a loop "
1253 "invariant address could not be vectorized",
1254 "CantVectorizeStoreToLoopInvariantAddress", ORE, TheLoop);
1264 "Invariant address is calculated inside the loop",
1265 "write to a loop invariant address could not "
1267 "CantVectorizeStoreToLoopInvariantAddress", ORE, TheLoop);
1295 I->getValueOperand()->getType() ==
1296 SI->getValueOperand()->getType();
1303 bool IsOK = UnhandledStores.
empty();
1307 "We don't allow storing to uniform addresses",
1308 "write to a loop invariant address could not "
1310 "CantVectorizeStoreToLoopInvariantAddress", ORE, TheLoop);
1321 bool EnableStrictReductions) {
1330 if (!EnableStrictReductions ||
1361 return V == InvariantAddress ||
1368 PHINode *PN = dyn_cast_or_null<PHINode>(In0);
1372 return Inductions.
count(PN);
1397 const Value *V)
const {
1398 auto *Inst = dyn_cast<Instruction>(V);
1399 return (Inst && InductionCastsToIgnore.
count(Inst));
1408 return FixedOrderRecurrences.
count(Phi);
1419 "Uncountable exiting block must be a direct predecessor of latch");
1425bool LoopVectorizationLegality::blockCanBePredicated(
1431 if (
match(&
I, m_Intrinsic<Intrinsic::assume>())) {
1439 if (isa<NoAliasScopeDeclInst>(&
I))
1446 if (
CallInst *CI = dyn_cast<CallInst>(&
I))
1453 if (
auto *LI = dyn_cast<LoadInst>(&
I)) {
1464 if (
auto *SI = dyn_cast<StoreInst>(&
I)) {
1469 if (
I.mayReadFromMemory() ||
I.mayWriteToMemory() ||
I.mayThrow())
1476bool LoopVectorizationLegality::canVectorizeWithIfConvert() {
1479 "IfConversionDisabled", ORE, TheLoop);
1518 auto CanSpeculatePointerOp = [
this](
Value *
Ptr) {
1521 while (!Worklist.
empty()) {
1523 if (!Visited.
insert(CurrV).second)
1526 auto *CurrI = dyn_cast<Instruction>(CurrV);
1527 if (!CurrI || !TheLoop->
contains(CurrI)) {
1566 if (isa<SwitchInst>(BB->getTerminator())) {
1569 "LoopContainsUnsupportedSwitch", ORE,
1570 TheLoop, BB->getTerminator());
1573 }
else if (!isa<BranchInst>(BB->getTerminator())) {
1575 "LoopContainsUnsupportedTerminator", ORE,
1576 TheLoop, BB->getTerminator());
1582 !blockCanBePredicated(BB, SafePointers, MaskedOp)) {
1584 "Control flow cannot be substituted for a select",
"NoCFGForSelect",
1585 ORE, TheLoop, BB->getTerminator());
1595bool LoopVectorizationLegality::canVectorizeLoopCFG(
Loop *Lp,
1596 bool UseVPlanNativePath) {
1598 "VPlan-native path is not enabled.");
1614 "loop control flow is not understood by vectorizer",
1615 "CFGNotUnderstood", ORE, TheLoop);
1616 if (DoExtraAnalysis)
1625 "loop control flow is not understood by vectorizer",
1626 "CFGNotUnderstood", ORE, TheLoop);
1627 if (DoExtraAnalysis)
1636bool LoopVectorizationLegality::canVectorizeLoopNestCFG(
1637 Loop *Lp,
bool UseVPlanNativePath) {
1642 if (!canVectorizeLoopCFG(Lp, UseVPlanNativePath)) {
1643 if (DoExtraAnalysis)
1651 for (
Loop *SubLp : *Lp)
1652 if (!canVectorizeLoopNestCFG(SubLp, UseVPlanNativePath)) {
1653 if (DoExtraAnalysis)
1662bool LoopVectorizationLegality::isVectorizableEarlyExitLoop() {
1666 "Cannot vectorize early exit loop",
1667 "NoLatchEarlyExit", ORE, TheLoop);
1671 if (Reductions.
size() || FixedOrderRecurrences.
size()) {
1673 "Found reductions or recurrences in early-exit loop",
1674 "Cannot vectorize early exit loop with reductions or recurrences",
1675 "RecurrencesInEarlyExitLoop", ORE, TheLoop);
1684 BasicBlock *SingleUncountableExitingBlock =
nullptr;
1688 if (isa<SCEVCouldNotCompute>(EC)) {
1691 "Early exiting block does not have exactly two successors",
1692 "Incorrect number of successors from early exiting block",
1693 "EarlyExitTooManySuccessors", ORE, TheLoop);
1697 if (SingleUncountableExitingBlock) {
1699 "Loop has too many uncountable exits",
1700 "Cannot vectorize early exit loop with more than one early exit",
1701 "TooManyUncountableEarlyExits", ORE, TheLoop);
1705 SingleUncountableExitingBlock = BB;
1707 CountableExitingBlocks.push_back(BB);
1715 if (!SingleUncountableExitingBlock) {
1716 LLVM_DEBUG(
dbgs() <<
"LV: Cound not find any uncountable exits");
1723 if (LatchPredBB != SingleUncountableExitingBlock) {
1725 "Cannot vectorize early exit loop",
1726 "EarlyExitNotLatchPredecessor", ORE, TheLoop);
1731 if (isa<SCEVCouldNotCompute>(
1734 "Cannot determine exact exit count for latch block",
1735 "Cannot vectorize early exit loop",
1736 "UnknownLatchExitCountEarlyExitLoop", ORE, TheLoop);
1740 "Latch block not found in list of countable exits!");
1745 switch (
I->getOpcode()) {
1746 case Instruction::Load:
1747 case Instruction::Store:
1748 case Instruction::PHI:
1749 case Instruction::Br:
1757 for (
auto *BB : TheLoop->
blocks())
1758 for (
auto &
I : *BB) {
1759 if (
I.mayWriteToMemory()) {
1762 "Writes to memory unsupported in early exit loops",
1763 "Cannot vectorize early exit loop with writes to memory",
1764 "WritesInEarlyExitLoop", ORE, TheLoop);
1766 }
else if (!IsSafeOperation(&
I)) {
1768 "cannot be speculatively executed",
1769 "UnsafeOperationsEarlyExitLoop", ORE,
1777 "Expected latch predecessor to be the early exiting block");
1785 "Cannot vectorize potentially faulting early exit loop",
1786 "PotentiallyFaultingEarlyExitLoop", ORE, TheLoop);
1790 [[maybe_unused]]
const SCEV *SymbolicMaxBTC =
1794 assert(!isa<SCEVCouldNotCompute>(SymbolicMaxBTC) &&
1795 "Failed to get symbolic expression for backedge taken count");
1796 LLVM_DEBUG(
dbgs() <<
"LV: Found an early exit loop with symbolic max "
1797 "backedge taken count: "
1798 << *SymbolicMaxBTC <<
'\n');
1799 UncountableExitingBB = SingleUncountableExitingBlock;
1811 if (!canVectorizeLoopNestCFG(TheLoop, UseVPlanNativePath)) {
1812 if (DoExtraAnalysis) {
1827 assert(UseVPlanNativePath &&
"VPlan-native path is not enabled.");
1829 if (!canVectorizeOuterLoop()) {
1831 "UnsupportedOuterLoop", ORE, TheLoop);
1844 if (NumBlocks != 1 && !canVectorizeWithIfConvert()) {
1846 if (DoExtraAnalysis)
1853 if (!canVectorizeInstrs()) {
1854 LLVM_DEBUG(
dbgs() <<
"LV: Can't vectorize the instructions or CFG\n");
1855 if (DoExtraAnalysis)
1864 "UnsupportedUncountableLoop", ORE, TheLoop);
1865 if (DoExtraAnalysis)
1870 if (!isVectorizableEarlyExitLoop()) {
1872 "Must be false without vectorizable early-exit loop");
1873 if (DoExtraAnalysis)
1882 if (!canVectorizeMemory()) {
1883 LLVM_DEBUG(
dbgs() <<
"LV: Can't vectorize due to memory conflicts\n");
1884 if (DoExtraAnalysis)
1893 ?
" (with a runtime bound check)"
1904 "due to SCEVThreshold");
1906 "Too many SCEV assumptions need to be made and checked at runtime",
1907 "TooManySCEVRunTimeChecks", ORE, TheLoop);
1908 if (DoExtraAnalysis)
1929 <<
"LV: Cannot fold tail by masking. Requires a singe latch exit\n");
1933 LLVM_DEBUG(
dbgs() <<
"LV: checking if tail can be folded by masking.\n");
1941 for (
auto *AE : AllowedExit) {
1944 if (ReductionLiveOuts.
count(AE))
1946 for (
User *U : AE->users()) {
1952 <<
"LV: Cannot fold tail by masking, loop has an outside user for "
1959 PHINode *OrigPhi = Entry.first;
1961 auto *UI = cast<Instruction>(U);
1963 LLVM_DEBUG(
dbgs() <<
"LV: Cannot fold tail by masking, loop IV has an "
1978 if (!blockCanBePredicated(BB, SafePointers, TmpMaskedOp)) {
1996 [[maybe_unused]]
bool R = blockCanBePredicated(BB, SafePointers, MaskedOp);
1997 assert(R &&
"Must be able to predicate block when tail-folding.");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
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 bool isZero(Value *V, const DataLayout &DL, DominatorTree *DT, AssumptionCache *AC)
loop Loop Strength Reduction
static cl::opt< LoopVectorizeHints::ScalableForceKind > ForceScalableVectorization("scalable-vectorization", cl::init(LoopVectorizeHints::SK_Unspecified), cl::Hidden, cl::desc("Control whether the compiler can use scalable vectors to " "vectorize a loop"), cl::values(clEnumValN(LoopVectorizeHints::SK_FixedWidthOnly, "off", "Scalable vectorization is disabled."), clEnumValN(LoopVectorizeHints::SK_PreferScalable, "preferred", "Scalable vectorization is available and favored when the " "cost is inconclusive."), clEnumValN(LoopVectorizeHints::SK_PreferScalable, "on", "Scalable vectorization is available and favored when the " "cost is inconclusive.")))
static cl::opt< unsigned > PragmaVectorizeSCEVCheckThreshold("pragma-vectorize-scev-check-threshold", cl::init(128), cl::Hidden, cl::desc("The maximum number of SCEV checks allowed with a " "vectorize(enable) pragma"))
static cl::opt< bool > HintsAllowReordering("hints-allow-reordering", cl::init(true), cl::Hidden, cl::desc("Allow enabling loop hints to reorder " "FP operations during vectorization."))
static const unsigned MaxInterleaveFactor
Maximum vectorization interleave count.
static cl::opt< bool > AllowStridedPointerIVs("lv-strided-pointer-ivs", cl::init(false), cl::Hidden, cl::desc("Enable recognition of non-constant strided " "pointer induction variables."))
static cl::opt< unsigned > VectorizeSCEVCheckThreshold("vectorize-scev-check-threshold", cl::init(16), cl::Hidden, cl::desc("The maximum number of SCEV checks allowed."))
static cl::opt< bool > EnableHistogramVectorization("enable-histogram-loop-vectorization", cl::init(false), cl::Hidden, cl::desc("Enables autovectorization of some loops containing histograms"))
static cl::opt< bool > EnableIfConversion("enable-if-conversion", cl::init(true), cl::Hidden, cl::desc("Enable if-conversion during vectorization."))
This file defines the LoopVectorizationLegality class.
void visit(MachineFunction &MF, MachineBasicBlock &Start, std::function< void(MachineBasicBlock *)> op)
Virtual Register Rewriter
static const uint32_t IV[8]
Class for arbitrary precision integers.
LLVM Basic Block Representation.
LLVM_ABI const BasicBlock * getUniquePredecessor() const
Return the predecessor of this block if it has a unique predecessor block.
LLVM_ABI LLVMContext & getContext() const
Get the context in which this basic block 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...
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation or the function signa...
This class represents a function call, abstracting a target machine's calling convention.
This is the shared class of boolean and integer constants.
A parsed version of the target data layout string in and methods for querying it.
static constexpr ElementCount getScalable(ScalarTy MinVal)
static constexpr ElementCount getFixed(ScalarTy MinVal)
constexpr bool isScalar() const
Exactly one element.
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
A struct for saving information about induction variables.
@ IK_FpInduction
Floating point induction variable.
@ IK_PtrInduction
Pointer induction var. Step = C.
@ IK_IntInduction
Integer induction variable. Step = C.
static LLVM_ABI bool isInductionPHI(PHINode *Phi, const Loop *L, ScalarEvolution *SE, InductionDescriptor &D, const SCEV *Expr=nullptr, SmallVectorImpl< Instruction * > *CastsToIgnore=nullptr)
Returns true if Phi is an induction in the loop L.
Instruction * getExactFPMathInst()
Returns floating-point induction operator that does not allow reassociation (transforming the inducti...
Class to represent integer types.
This is an important class for using LLVM in a threaded context.
An instruction for reading from memory.
Value * getPointerOperand()
LLVM_ABI const LoopAccessInfo & getInfo(Loop &L, bool AllowPartial=false)
const MemoryDepChecker & getDepChecker() const
the Memory Dependence Checker which can determine the loop-independent and loop-carried dependences b...
ArrayRef< StoreInst * > getStoresToInvariantAddresses() const
Return the list of stores to invariant addresses.
const OptimizationRemarkAnalysis * getReport() const
The diagnostics report generated for the analysis.
const RuntimePointerChecking * getRuntimePointerChecking() const
bool canVectorizeMemory() const
Return true we can analyze the memory accesses in the loop and there are no memory dependence cycles.
LLVM_ABI bool isInvariant(Value *V) const
Returns true if value V is loop invariant.
bool hasLoadStoreDependenceInvolvingLoopInvariantAddress() const
Return true if the loop has memory dependence involving a load and a store to an invariant address,...
const PredicatedScalarEvolution & getPSE() const
Used to add runtime SCEV checks.
static LLVM_ABI bool blockNeedsPredication(BasicBlock *BB, Loop *TheLoop, DominatorTree *DT)
Return true if the block BB needs to be predicated in order for the loop to be vectorized.
const DenseMap< Value *, const SCEV * > & getSymbolicStrides() const
If an access has a symbolic strides, this maps the pointer value to the stride symbol.
bool hasStoreStoreDependenceInvolvingLoopInvariantAddress() const
Return true if the loop has memory dependence involving two stores to an invariant address,...
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.
bool isInnermost() const
Return true if the loop does not contain any (natural) loops.
unsigned getNumBlocks() const
Get the number of blocks in this loop in constant time.
unsigned getNumBackEdges() const
Calculate the number of back edges to the loop header.
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 * getLoopPredecessor() const
If the given loop's header has exactly one unique predecessor outside the loop, return it.
BlockT * getLoopPreheader() const
If there is a preheader for this loop, return it.
BlockT * getExitingBlock() const
If getExitingBlocks would return exactly one block, return that block.
bool isLoopExiting(const BlockT *BB) const
True if terminator in the block can branch to another block that is outside of the current loop.
bool isLoopHeader(const BlockT *BB) const
bool isInvariantStoreOfReduction(StoreInst *SI)
Returns True if given store is a final invariant store of one of the reductions found in the loop.
bool isInvariantAddressOfReduction(Value *V)
Returns True if given address is invariant and is used to store recurrent expression.
bool blockNeedsPredication(BasicBlock *BB) const
Return true if the block BB needs to be predicated in order for the loop to be vectorized.
bool canVectorize(bool UseVPlanNativePath)
Returns true if it is legal to vectorize this loop.
int isConsecutivePtr(Type *AccessTy, Value *Ptr) const
Check if this pointer is consecutive when vectorizing.
bool canVectorizeFPMath(bool EnableStrictReductions)
Returns true if it is legal to vectorize the FP math operations in this loop.
bool isFixedOrderRecurrence(const PHINode *Phi) const
Returns True if Phi is a fixed-order recurrence in this loop.
const InductionDescriptor * getPointerInductionDescriptor(PHINode *Phi) const
Returns a pointer to the induction descriptor, if Phi is pointer induction.
const InductionDescriptor * getIntOrFpInductionDescriptor(PHINode *Phi) const
Returns a pointer to the induction descriptor, if Phi is an integer or floating point induction.
bool isInductionPhi(const Value *V) const
Returns True if V is a Phi node of an induction variable in this loop.
bool isUniform(Value *V, ElementCount VF) const
Returns true if value V is uniform across VF lanes, when VF is provided, and otherwise if V is invari...
const InductionList & getInductionVars() const
Returns the induction variables found in the loop.
bool isInvariant(Value *V) const
Returns true if V is invariant across all loop iterations according to SCEV.
const ReductionList & getReductionVars() const
Returns the reduction variables found in the loop.
bool canFoldTailByMasking() const
Return true if we can vectorize this loop while folding its tail by masking.
void prepareToFoldTailByMasking()
Mark all respective loads/stores for masking.
bool hasUncountableEarlyExit() const
Returns true if the loop has exactly one uncountable early exit, i.e.
bool isUniformMemOp(Instruction &I, ElementCount VF) const
A uniform memory op is a load or store which accesses the same memory location on all VF lanes,...
BasicBlock * getUncountableEarlyExitingBlock() const
Returns the uncountable early exiting block, if there is exactly one.
bool isInductionVariable(const Value *V) const
Returns True if V can be considered as an induction variable in this loop.
bool isCastedInductionVariable(const Value *V) const
Returns True if V is a cast that is part of an induction def-use chain, and had been proven to be red...
Instruction * getExactFPInst()
void addExactFPMathInst(Instruction *I)
Track the 1st floating-point instruction that can not be reassociated.
@ SK_PreferScalable
Vectorize loops using scalable vectors or fixed-width vectors, but favor scalable vectors when the co...
@ SK_Unspecified
Not selected.
@ SK_FixedWidthOnly
Disables vectorization with scalable vectors.
enum ForceKind getForce() const
bool allowVectorization(Function *F, Loop *L, bool VectorizeOnlyWhenForced) const
bool allowReordering() const
When enabling loop hints are provided we allow the vectorizer to change the order of operations that ...
void emitRemarkWithHints() const
Dumps all the hint information.
ElementCount getWidth() const
@ FK_Enabled
Forcing enabled.
@ FK_Undefined
Not selected.
@ FK_Disabled
Forcing disabled.
void setAlreadyVectorized()
Mark the loop L as already vectorized by setting the width to 1.
LoopVectorizeHints(const Loop *L, bool InterleaveOnlyWhenForced, OptimizationRemarkEmitter &ORE, const TargetTransformInfo *TTI=nullptr)
const char * vectorizeAnalysisPassName() const
If hints are provided that force vectorization, use the AlwaysPrint pass name to force the frontend t...
unsigned getInterleave() const
unsigned getIsVectorized() const
Represents a single loop in the control flow graph.
bool isLoopInvariant(const Value *V, bool HasCoroSuspendInst=false) const
Return true if the specified value is loop invariant.
DebugLoc getStartLoc() const
Return the debug location of the start of this loop.
void setLoopID(MDNode *LoopID) const
Set the llvm.loop loop id metadata for this loop.
PHINode * getCanonicalInductionVariable() const
Check to see if the loop has a canonical induction variable: an integer recurrence that starts at 0 a...
MDNode * getLoopID() const
Return the llvm.loop loop id metadata node for this loop if it is present.
const MDOperand & getOperand(unsigned I) const
ArrayRef< MDOperand > operands() const
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
unsigned getNumOperands() const
Return number of MDNode operands.
Tracking metadata reference owned by Metadata.
LLVM_ABI StringRef getString() const
static LLVM_ABI MDString * get(LLVMContext &Context, StringRef Str)
size_type count(const KeyT &Key) const
iterator find(const KeyT &Key)
Checks memory dependences among accesses to the same underlying object to determine whether there vec...
const SmallVectorImpl< Dependence > * getDependences() const
Returns the memory dependences.
An interface layer with SCEV used to manage how we see SCEV expressions for values in the context of ...
LLVM_ABI void addPredicate(const SCEVPredicate &Pred)
Adds a new predicate.
ScalarEvolution * getSE() const
Returns the ScalarEvolution analysis used.
LLVM_ABI const SCEVPredicate & getPredicate() const
LLVM_ABI const SCEV * getBackedgeTakenCount()
Get the (predicated) backedge count for the analyzed loop.
LLVM_ABI const SCEV * getSymbolicMaxBackedgeTakenCount()
Get the (predicated) symbolic max backedge count for the analyzed loop.
LLVM_ABI const SCEV * getSCEV(Value *V)
Returns the SCEV expression of V, in the context of the current SCEV predicate.
The RecurrenceDescriptor is used to identify recurrences variables in a loop.
Instruction * getExactFPMathInst() const
Returns 1st non-reassociative FP instruction in the PHI node's use-chain.
static LLVM_ABI bool isFixedOrderRecurrence(PHINode *Phi, Loop *TheLoop, DominatorTree *DT)
Returns true if Phi is a fixed-order recurrence.
bool hasExactFPMath() const
Returns true if the recurrence has floating-point math that requires precise (ordered) operations.
Instruction * getLoopExitInstr() const
static LLVM_ABI bool isReductionPHI(PHINode *Phi, Loop *TheLoop, RecurrenceDescriptor &RedDes, DemandedBits *DB=nullptr, AssumptionCache *AC=nullptr, DominatorTree *DT=nullptr, ScalarEvolution *SE=nullptr)
Returns true if Phi is a reduction in TheLoop.
bool isOrdered() const
Expose an ordered FP reduction to the instance users.
StoreInst * IntermediateStore
Reductions may store temporary or final result to an invariant address.
bool Need
This flag indicates if we need to add the runtime check.
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.
const Loop * getLoop() const
virtual unsigned getComplexity() const
Returns the estimated complexity of this predicate.
virtual bool isAlwaysTrue() const =0
Returns true if the predicate is always true.
This visitor recursively visits a SCEV expression and re-writes it.
const SCEV * visit(const SCEV *S)
This means that we are dealing with an entirely unknown SCEV value, and only represent it as its LLVM...
This class represents an analyzed expression in the program.
The main scalar evolution driver.
LLVM_ABI const SCEV * getSCEV(Value *V)
Return a SCEV expression for the full generality of the specified expression.
LLVM_ABI bool isLoopInvariant(const SCEV *S, const Loop *L)
Return true if the value of the given SCEV is unchanging in the specified loop.
LLVM_ABI bool isSCEVable(Type *Ty) const
Test if values of the given type are analyzable within the SCEV framework.
LLVM_ABI const SCEV * getPredicatedExitCount(const Loop *L, const BasicBlock *ExitingBlock, SmallVectorImpl< const SCEVPredicate * > *Predicates, ExitCountKind Kind=Exact)
Same as above except this uses the predicated backedge taken info and may require predicates.
LLVM_ABI const SCEV * getCouldNotCompute()
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
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.
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.
An instruction for storing to memory.
Value * getPointerOperand()
StringRef - Represent a constant reference to a string, i.e.
static constexpr size_t npos
Provides information about what library functions are available for the current target.
bool hasOptimizedCodeGen(LibFunc F) const
Tests if the function is both available and a candidate for optimized code generation.
void getWidestVF(StringRef ScalarF, ElementCount &FixedVF, ElementCount &ScalableVF) const
Returns the largest vectorization factor used in the list of vector functions.
bool getLibFunc(StringRef funcName, LibFunc &F) const
Searches for a particular function name.
bool isFunctionVectorizable(StringRef F, const ElementCount &VF) const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM_ABI std::string str() const
Return the twine contents as a std::string.
The instances of the Type class are immutable: once they are created, they are never changed.
bool isVectorTy() const
True if this is an instance of VectorType.
bool isPointerTy() const
True if this is an instance of PointerType.
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
LLVM_ABI unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
bool isFloatingPointTy() const
Return true if this is one of the floating-point types.
bool isIntOrPtrTy() const
Return true if this is an integer type or a pointer type.
LLVM_ABI unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
bool isIntegerTy() const
True if this is an instance of IntegerType.
Value * getOperand(unsigned i) const
static bool hasMaskedVariant(const CallInst &CI, std::optional< ElementCount > VF=std::nullopt)
static SmallVector< VFInfo, 8 > getMappings(const CallInst &CI)
Retrieve all the VFInfo instances associated to the CallInst CI.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
iterator_range< user_iterator > users()
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
static LLVM_ABI bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
static constexpr bool isKnownLE(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
constexpr bool isScalable() const
Returns whether the quantity is scaled by a runtime quantity (vscale).
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
constexpr bool isZero() const
const ParentTy * getParent() const
self_iterator getIterator()
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ C
The default llvm calling convention, compatible with C.
TwoOps_match< ValueOpTy, PointerOpTy, Instruction::Store > m_Store(const ValueOpTy &ValueOp, const PointerOpTy &PointerOp)
Matches StoreInst.
BinaryOp_match< LHS, RHS, Instruction::Add > m_Add(const LHS &L, const RHS &R)
class_match< BinaryOperator > m_BinOp()
Match an arbitrary binary operation and ignore it.
bool match(Val *V, const Pattern &P)
bind_ty< Instruction > m_Instruction(Instruction *&I)
Match an instruction, capturing it if we match.
specificval_ty m_Specific(const Value *V)
Match if we have a specific specified value.
match_combine_or< match_combine_or< CastInst_match< OpTy, ZExtInst >, CastInst_match< OpTy, SExtInst > >, OpTy > m_ZExtOrSExtOrSelf(const OpTy &Op)
OneOps_match< OpTy, Instruction::Load > m_Load(const OpTy &Op)
Matches LoadInst.
class_match< Value > m_Value()
Match an arbitrary value and ignore it.
BinaryOp_match< LHS, RHS, Instruction::Sub > m_Sub(const LHS &L, const RHS &R)
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)
NodeAddr< PhiNode * > Phi
NodeAddr< FuncNode * > Func
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 all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
LLVM_ABI Intrinsic::ID getVectorIntrinsicIDForCall(const CallInst *CI, const TargetLibraryInfo *TLI)
Returns intrinsic ID for call.
auto successors(const MachineBasicBlock *BB)
const Value * getLoadStorePointerOperand(const Value *V)
A helper function that returns the pointer operand of a load or store instruction.
static bool isUniformLoopNest(Loop *Lp, Loop *OuterLp)
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
LLVM_ABI bool shouldOptimizeForSize(const MachineFunction *MF, ProfileSummaryInfo *PSI, const MachineBlockFrequencyInfo *BFI, PGSOQueryType QueryType=PGSOQueryType::Other)
Returns true if machine function MF is suggested to be size-optimized based on the profile.
static bool isUniformLoop(Loop *Lp, Loop *OuterLp)
LLVM_ABI bool mustSuppressSpeculation(const LoadInst &LI)
Return true if speculation of the given load must be suppressed to avoid ordering or interfering with...
static bool canWidenCallReturnType(Type *Ty)
Returns true if the call return type Ty can be widened by the loop vectorizer.
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 bool isDereferenceableReadOnlyLoop(Loop *L, ScalarEvolution *SE, DominatorTree *DT, AssumptionCache *AC, SmallVectorImpl< const SCEVPredicate * > *Predicates=nullptr)
Return true if the loop L cannot fault on any iteration and only contains read-only memory accesses.
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)
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
static IntegerType * getWiderInductionTy(const DataLayout &DL, Type *Ty0, Type *Ty1)
static IntegerType * getInductionIntegerTy(const DataLayout &DL, Type *Ty)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI std::optional< int64_t > getPtrStride(PredicatedScalarEvolution &PSE, Type *AccessTy, Value *Ptr, const Loop *Lp, const DenseMap< Value *, const SCEV * > &StridesMap=DenseMap< Value *, const SCEV * >(), bool Assume=false, bool ShouldCheckWrap=true)
If the pointer has a constant stride return it in units of the access type size.
static bool hasOutsideLoopUser(const Loop *TheLoop, Instruction *Inst, SmallPtrSetImpl< Value * > &AllowedExit)
Check that the instruction has outside loop users and is not an identified reduction variable.
static bool storeToSameAddress(ScalarEvolution *SE, StoreInst *A, StoreInst *B)
Returns true if A and B have same pointer operands or same SCEVs addresses.
bool canVectorizeTy(Type *Ty)
Returns true if Ty is a valid vector element type, void, or an unpacked literal struct where all elem...
LLVM_ABI bool isVectorIntrinsicWithScalarOpAtArg(Intrinsic::ID ID, unsigned ScalarOpdIdx, const TargetTransformInfo *TTI)
Identifies if the vector form of the intrinsic has a scalar operand.
LLVM_ABI void reportVectorizationFailure(const StringRef DebugMsg, const StringRef OREMsg, const StringRef ORETag, OptimizationRemarkEmitter *ORE, Loop *TheLoop, Instruction *I=nullptr)
Reports a vectorization failure: print DebugMsg for debugging purposes along with the corresponding o...
LLVM_ABI llvm::MDNode * makePostTransformationMetadata(llvm::LLVMContext &Context, MDNode *OrigLoopID, llvm::ArrayRef< llvm::StringRef > RemovePrefixes, llvm::ArrayRef< llvm::MDNode * > AddAttrs)
Create a new LoopID after the loop has been transformed.
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
auto predecessors(const MachineBasicBlock *BB)
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
static bool findHistogram(LoadInst *LI, StoreInst *HSt, Loop *TheLoop, const PredicatedScalarEvolution &PSE, SmallVectorImpl< HistogramInfo > &Histograms)
Find histogram operations that match high-level code in loops:
LLVM_ABI bool isGuaranteedNotToBePoison(const Value *V, AssumptionCache *AC=nullptr, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr, unsigned Depth=0)
Returns true if V cannot be poison, but may be undef.
static bool isTLIScalarize(const TargetLibraryInfo &TLI, const CallInst &CI)
Checks if a function is scalarizable according to the TLI, in the sense that it should be vectorized ...
LLVM_ABI bool isDereferenceableAndAlignedInLoop(LoadInst *LI, Loop *L, ScalarEvolution &SE, DominatorTree &DT, AssumptionCache *AC=nullptr, SmallVectorImpl< const SCEVPredicate * > *Predicates=nullptr)
Return true if we can prove that the given load (which is assumed to be within the specified loop) wo...
bool SCEVExprContains(const SCEV *Root, PredTy Pred)
Return true if any node in Root satisfies the predicate Pred.
Dependece between memory access instructions.
Instruction * getDestination(const MemoryDepChecker &DepChecker) const
Return the destination instruction of the dependence.
Instruction * getSource(const MemoryDepChecker &DepChecker) const
Return the source instruction of the dependence.
static LLVM_ABI VectorizationSafetyStatus isSafeForVectorization(DepType Type)
Dependence types that don't prevent vectorization.
An object of this class is returned by queries that could not be answered.
TODO: The following VectorizationFactor was pulled out of LoopVectorizationCostModel class.
Collection of parameters shared beetween the Loop Vectorizer and the Loop Access Analysis.
static LLVM_ABI const unsigned MaxVectorWidth
Maximum SIMD width.
static LLVM_ABI bool isInterleaveForced()
True if force-vector-interleave was specified by the user.
static LLVM_ABI unsigned VectorizationInterleave
Interleave factor as overridden by the user.