Lines Matching +full:batched +full:- +full:4 +full:d
1 //===- LoopAccessAnalysis.cpp - Loop Access Analysis Implementation --------==//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
71 #define DEBUG_TYPE "loop-accesses"
74 VectorizationFactor("force-vector-width", cl::Hidden,
80 VectorizationInterleave("force-vector-interleave", cl::Hidden,
88 "runtime-memory-check-threshold", cl::Hidden,
96 "memory-check-merge-threshold", cl::Hidden,
106 MaxDependences("max-dependences", cl::Hidden,
108 "loop-access analysis (default = 100)"),
118 /// for (i = 0; i < N; i+=4)
123 "enable-mem-access-versioning", cl::init(true), cl::Hidden,
126 /// Enable store-to-load forwarding conflict detection. This option can
129 "store-to-load-forwarding-conflict-detection", cl::Hidden,
130 cl::desc("Enable conflict detection in loop-access analysis"),
134 "max-forked-scev-depth", cl::Hidden,
139 "laa-speculate-unit-stride", cl::Hidden,
140 cl::desc("Speculate that non-constant strides are unit in LAA"),
144 "hoist-runtime-checks", cl::Hidden,
163 // For a non-symbolic stride, just return the original expression.
166 const SCEV *StrideSCEV = SI->second;
174 const SCEV *CT = SE->getOne(StrideSCEV->getType());
175 PSE.addPredicate(*SE->getEqualPredicate(StrideSCEV, CT));
187 .PointerValue->getType()
188 ->getPointerAddressSpace()),
200 auto [Iter, Ins] = PointerBounds->insert(
202 {SE->getCouldNotCompute(), SE->getCouldNotCompute()}});
204 return Iter->second;
205 PtrBoundsPair = &Iter->second;
211 if (SE->isLoopInvariant(PtrExpr, Lp)) {
214 ScStart = AR->getStart();
215 ScEnd = AR->evaluateAtIteration(MaxBECount, *SE);
216 const SCEV *Step = AR->getStepRecurrence(*SE);
221 if (CStep->getValue()->isNegative())
227 ScStart = SE->getUMinExpr(ScStart, ScEnd);
228 ScEnd = SE->getUMaxExpr(AR->getStart(), ScEnd);
231 return {SE->getCouldNotCompute(), SE->getCouldNotCompute()};
233 assert(SE->isLoopInvariant(ScStart, Lp) && "ScStart needs to be invariant");
234 assert(SE->isLoopInvariant(ScEnd, Lp) && "ScEnd needs to be invariant");
237 auto &DL = Lp->getHeader()->getDataLayout();
238 Type *IdxTy = DL.getIndexType(PtrExpr->getType());
239 const SCEV *EltSizeSCEV = SE->getStoreSizeOfExpr(IdxTy, AccessTy);
240 ScEnd = SE->getAddExpr(ScEnd, EltSizeSCEV);
278 if (!DC.getOrderForAccess(Src->PointerValue, !Src->IsWritePtr).empty() ||
279 !DC.getOrderForAccess(Sink->PointerValue, !Sink->IsWritePtr).empty())
283 DC.getOrderForAccess(Src->PointerValue, Src->IsWritePtr);
285 DC.getOrderForAccess(Sink->PointerValue, Sink->IsWritePtr);
295 auto *SrcAR = dyn_cast<SCEVAddRecExpr>(Src->Expr);
296 auto *SinkAR = dyn_cast<SCEVAddRecExpr>(Sink->Expr);
297 if (!SrcAR || !SinkAR || SrcAR->getLoop() != DC.getInnermostLoop() ||
298 SinkAR->getLoop() != DC.getInnermostLoop())
301 SmallVector<Instruction *, 4> SrcInsts =
302 DC.getInstructionsForAccess(Src->PointerValue, Src->IsWritePtr);
303 SmallVector<Instruction *, 4> SinkInsts =
304 DC.getInstructionsForAccess(Sink->PointerValue, Sink->IsWritePtr);
311 SinkAR->getLoop()->getHeader()->getDataLayout();
318 auto *Step = dyn_cast<SCEVConstant>(SinkAR->getStepRecurrence(*SE));
319 if (!Step || Step != SrcAR->getStepRecurrence(*SE) ||
320 Step->getAPInt().abs() != AllocSize)
324 IntegerType::get(Src->PointerValue->getContext(),
328 if (Step->getValue()->isNegative())
331 const SCEV *SinkStartInt = SE->getPtrToIntExpr(SinkAR->getStart(), IntTy);
332 const SCEV *SrcStartInt = SE->getPtrToIntExpr(SrcAR->getStart(), IntTy);
337 const Loop *InnerLoop = SrcAR->getLoop();
342 if (HoistRuntimeChecks && InnerLoop->getParentLoop() &&
346 const Loop *StartARLoop = SrcStartAR->getLoop();
347 if (StartARLoop == SinkStartAR->getLoop() &&
348 StartARLoop == InnerLoop->getParentLoop() &&
352 SrcStartAR->getStepRecurrence(*SE) !=
353 SinkStartAR->getStepRecurrence(*SE)) {
364 Src->NeedsFreeze || Sink->NeedsFreeze);
368 SmallVector<RuntimePointerCheck, 4> RuntimePointerChecking::generateChecks() {
369 SmallVector<RuntimePointerCheck, 4> Checks;
405 std::optional<APInt> Diff = SE->computeConstantDifference(J, I);
408 return Diff->isNegative() ? J : I;
415 RtCheck.Pointers[Index].PointerValue->getType()->getPointerAddressSpace(),
446 this->NeedsFreeze |= NeedsFreeze;
454 // - We know that pointers in the same equivalence class share
457 // - We wouldn't be able to merge two pointers for which we need
465 // - if the difference between this pointer and the min/max bounds
472 // with a non-constant difference, we shouldn't perform any pointer
534 auto PointerI = PositionMap.find(MI->getPointer());
537 for (unsigned Pointer : PointerI->second) {
577 return (PtrToPartition[PtrIdx1] != -1 &&
602 const auto &First = Check1->Members, &Second = Check2->Members;
618 OS.indent(Depth) << "Run-time memory checks:\n";
624 OS.indent(Depth + 4) << "(Low: " << *CG.Low << " High: " << *CG.High
670 /// Check if we can emit a run-time no-alias check for \p Access.
672 /// Returns true if we can emit a run-time no alias check for \p Access.
674 /// adds a run-time to check for it to \p RtCheck. If \p Assume is true,
675 /// we will attempt to use additional run-time checks in order to get
685 /// non-intersection.
734 // iteration-local.
735 if (any_of(ScopeList->operands(), [&](Metadata *Scope) {
760 /// Batched alias analysis results.
770 /// Sets of potentially dependent accesses - members of one set share an
784 /// The SCEV predicate containing all the SCEV-related assumptions.
798 /// by adding run-time checks (overflow checks) if necessary.
801 // The bounds for loop-invariant pointer is trivial.
802 if (PSE.getSE()->isLoopInvariant(PtrScev, L))
813 return AR->isAffine();
821 if (PSE.getSE()->isLoopInvariant(PtrScev, L))
839 // SCEV does not look through non-header PHIs inside the loop. Such phis
842 if (PN && InnermostLoop.contains(PN->getParent()) &&
843 PN->getParent() != InnermostLoop.getHeader()) {
844 for (const Use &Inc : PN->incoming_values())
876 const SCEV *Scev = SE->getSCEV(Ptr);
877 if (isa<SCEVAddRecExpr>(Scev) || L->isLoopInvariant(Ptr) ||
883 Depth--;
892 return SE->getAddExpr(L, R);
894 return SE->getMinusSCEV(L, R);
901 unsigned Opcode = I->getOpcode();
905 Type *SourceTy = GEP->getSourceElementType();
908 if (I->getNumOperands() != 2 || SourceTy->isVectorTy()) {
914 findForkedSCEVs(SE, L, I->getOperand(0), BaseScevs, Depth);
915 findForkedSCEVs(SE, L, I->getOperand(1), OffsetScevs, Depth);
934 Type *IntPtrTy = SE->getEffectiveSCEVType(
935 SE->getSCEV(GEP->getPointerOperand())->getType());
940 const SCEV *Size = SE->getSizeOfExpr(IntPtrTy, SourceTy);
943 const SCEV *Scaled1 = SE->getMulExpr(
944 Size, SE->getTruncateOrSignExtend(get<0>(OffsetScevs[0]), IntPtrTy));
945 const SCEV *Scaled2 = SE->getMulExpr(
946 Size, SE->getTruncateOrSignExtend(get<0>(OffsetScevs[1]), IntPtrTy));
947 ScevList.emplace_back(SE->getAddExpr(get<0>(BaseScevs[0]), Scaled1),
949 ScevList.emplace_back(SE->getAddExpr(get<0>(BaseScevs[1]), Scaled2),
958 findForkedSCEVs(SE, L, I->getOperand(1), ChildScevs, Depth);
959 findForkedSCEVs(SE, L, I->getOperand(2), ChildScevs, Depth);
972 if (I->getNumOperands() == 2) {
973 findForkedSCEVs(SE, L, I->getOperand(0), ChildScevs, Depth);
974 findForkedSCEVs(SE, L, I->getOperand(1), ChildScevs, Depth);
987 findForkedSCEVs(SE, L, I->getOperand(0), LScevs, Depth);
988 findForkedSCEVs(SE, L, I->getOperand(1), RScevs, Depth);
1027 assert(SE->isSCEVable(Ptr->getType()) && "Value is not SCEVable!");
1035 SE->isLoopInvariant(get<0>(Scevs[0]), L)) &&
1037 SE->isLoopInvariant(get<0>(Scevs[1]), L))) {
1132 SmallVector<std::pair<MemAccessInfo, Type *>, 4> Retries;
1136 SmallVector<MemAccessInfo, 4> AccessInfos;
1182 // dependence sets (in which case RunningDepId > 2) or if we need to re-try
1187 // We need to perform run-time alias checks, but some pointers had bounds
1229 unsigned ASi = PtrI->getType()->getPointerAddressSpace();
1230 unsigned ASj = PtrJ->getType()->getPointerAddressSpace();
1246 // If we can do run-time checks, but there are no checks, no runtime checks
1258 // We process the set twice: first we process read-write pointers, last we
1259 // process read-only pointers. This allows us to skip dependence tests for
1260 // read-only pointers.
1269 : (ReadOnlyPtr.count(A.getPointer()) ? "read-only"
1275 // compatibility and potential for underlying-object overlap. As a result, we
1279 // Note that both the alias-set tracker and the alias sets themselves used
1294 // and then to process read-only pointers.
1319 "Alias-set pointer not in the access set?");
1324 // Memorize read-only pointers for later processing and skip them in
1327 // consecutive as "read-only" pointers (so that we check
1336 // If this is a write - check other reads and writes for conflicts. If
1338 // there is no other write to the ptr - this is an optimization to
1363 TheLoop->getHeader()->getParent(),
1364 UnderlyingObj->getType()->getPointerAddressSpace()))
1370 DepCands.unionSets(Access, Prev->second);
1381 /// Return true if an AddRec pointer \p Ptr is unsigned non-wrapping,
1387 if (AR->getNoWrapFlags(SCEV::NoWrapMask))
1393 // Scalar evolution does not propagate the non-wrapping flags to values that
1394 // are derived from a non-wrapping induction variable because non-wrapping
1395 // could be flow-sensitive.
1398 // non-wrapping for the *specific* value of Ptr.
1402 if (!GEP || !GEP->hasNoUnsignedSignedWrap())
1405 // Make sure there is only one non-const index and analyze that.
1407 for (Value *Index : GEP->indices())
1417 // The index in GEP is signed. It is non-wrapping if it's derived from a NSW
1420 if (OBO->hasNoSignedWrap() &&
1423 isa<ConstantInt>(OBO->getOperand(1))) {
1424 const SCEV *OpScev = PSE.getSCEV(OBO->getOperand(0));
1427 return OpAR->getLoop() == L && OpAR->getNoWrapFlags(SCEV::FlagNSW);
1440 if (PSE.getSE()->isLoopInvariant(PtrScev, Lp))
1443 Type *Ty = Ptr->getType();
1444 assert(Ty->isPointerTy() && "Unexpected non-ptr");
1446 LLVM_DEBUG(dbgs() << "LAA: Bad stride - Scalable object: " << *AccessTy
1456 LLVM_DEBUG(dbgs() << "LAA: Bad stride - Not an AddRecExpr pointer " << *Ptr
1462 if (Lp != AR->getLoop()) {
1463 LLVM_DEBUG(dbgs() << "LAA: Bad stride - Not striding over innermost loop "
1469 const SCEV *Step = AR->getStepRecurrence(*PSE.getSE());
1474 LLVM_DEBUG(dbgs() << "LAA: Bad stride - Not a constant strided " << *Ptr
1479 const auto &DL = Lp->getHeader()->getDataLayout();
1482 const APInt &APStepVal = C->getAPInt();
1484 // Huge step value - give up.
1510 GEP && GEP->hasNoUnsignedSignedWrap())
1516 unsigned AddrSpace = Ty->getPointerAddressSpace();
1517 if (!NullPointerIsDefined(Lp->getHeader()->getParent(), AddrSpace) &&
1518 (Stride == 1 || Stride == -1))
1530 dbgs() << "LAA: Bad stride - Pointer may wrap in the address space "
1540 assert(PtrA && PtrB && "Expected non-nullptr pointers.");
1550 unsigned ASA = PtrA->getType()->getPointerAddressSpace();
1551 unsigned ASB = PtrB->getType()->getPointerAddressSpace();
1559 const Value *PtrA1 = PtrA->stripAndAccumulateConstantOffsets(
1561 const Value *PtrB1 = PtrB->stripAndAccumulateConstantOffsets(
1568 ASA = cast<PointerType>(PtrA1->getType())->getAddressSpace();
1569 ASB = cast<PointerType>(PtrB1->getType())->getAddressSpace();
1578 OffsetB -= OffsetA;
1588 Val = Diff->getSExtValue();
1593 // Ensure that the calculated distance matches the type-based one after all
1604 VL, [](const Value *V) { return V->getType()->isPointerTy(); }) &&
1631 // Fill SortedIndices array only if it is non-consecutive.
1655 visitPointers(SI->getPointerOperand(), *InnermostLoop,
1664 visitPointers(LI->getPointerOperand(), *InnermostLoop,
1732 // factor store-load forwarding does not take place.
1734 // prevent store-load forwarding making vectorized code run a lot slower.
1735 // a[i] = a[i-3] ^ a[i-8];
1736 // The stores to a[i:i+1] don't align with the stores to a[i-3:i-2] and
1737 // hence on your typical architecture store-load forwarding does not take
1739 // Store-load forwarding distance.
1741 // After this many iterations store-to-load forwarding conflicts should not
1762 << " that could cause a store-load forwarding conflict\n");
1778 /// Given a dependence-distance \p Dist between two
1786 /// for (i = 0; i < D; ++i) {
1788 /// out[i+D] =
1819 uint64_t ProductTypeSizeBits = DL.getTypeSizeInBits(Product->getType());
1823 // backedgeTakenCount is non-negative, so we zero extend Product.
1827 CastedDist = SE.getNoopOrSignExtend(&Dist, Product->getType());
1829 // Is Dist - (MaxBTC * Step) > 0 ?
1835 // Second try: Is -Dist - (MaxBTC * Step) > 0 ?
1836 // (If so, then we have proven (**) because |Dist| >= -1*Dist)
1850 assert(TypeByteSize > 0 && "The type size in byte must be non-zero");
1851 assert(Distance > 0 && "The distance must be non-zero");
1861 // for (i = 0; i < 1024 ; i += 4)
1864 // Two accesses in memory (scaled distance is 2, stride is 4):
1865 // | A[0] | | | | A[4] | | | |
1870 // A[i+4] = A[i] + 1;
1872 // Two accesses in memory (scaled distance is 4, stride is 3):
1874 // | | | | | A[4] | | | A[7] | |
1883 const auto &DL = InnermostLoop->getHeader()->getDataLayout();
1896 if (APtr->getType()->getPointerAddressSpace() !=
1897 BPtr->getType()->getPointerAddressSpace())
1927 // sink are loop invariant to avoid compile-time increases. This is not
1959 // If either Src or Sink are not strided (i.e. not a non-wrapping AddRec) and
1960 // not loop-invariant (stride will be 0 in that case), we cannot analyze the
1963 LLVM_DEBUG(dbgs() << "Pointer access with non-constant stride\n");
2028 // with non-constant distance dependencies.
2035 auto &DL = InnermostLoop->getHeader()->getDataLayout();
2051 uint64_t Distance = ConstDist->getAPInt().abs().getZExtValue();
2099 ConstDist->getAPInt().abs().getZExtValue(), TypeByteSize)) {
2101 dbgs() << "LAA: Forward but may prevent st->ld forwarding\n");
2119 // FoundNonConstantDistanceDependence to force re-trying with runtime
2121 // original behavior w.r.t. re-trying with runtime checks.
2130 LLVM_DEBUG(dbgs() << "LAA: ReadWrite-Write positive dependency with "
2138 // Bail out early if passed-in parameters make vectorization not feasible.
2151 // E.g. Assume one char is 1 byte in memory and one int is 4 bytes.
2159 // | A[0] | | A[2] | | A[4] | | A[6] | |
2160 // | B[0] | | B[2] | | B[4] |
2163 // 4 * 2 * (MinNumIter - 1). MinDistance needs for the last iteration: 4.
2164 // So the minimum distance needed is: 4 * 2 * (MinNumIter - 1) + 4.
2169 // If MinNumIter is 4 (Say if a user forces the vectorization factor to be 4),
2177 TypeByteSize * *CommonStride * (MinNumIter - 1) + TypeByteSize;
2180 // For non-constant distances, we checked the lower bound of the
2182 // for vectorization). Classify it as Unknown, so we re-try with runtime
2202 // E.g. Assume one char is 1 byte in memory and one int is 4 bytes.
2239 // For non-constant distances, we checked the lower bound of the dependence
2241 // vectorization). Classify it as Unknown, so we re-try with runtime checks.
2252 MinDepDistBytes = -1;
2271 bool AIIsWrite = AI->getInt();
2273 // other stores in the same equivalence class - to the same address.
2325 SmallVector<Instruction *, 4>
2328 auto &IndexVector = Accesses.find(Access)->second;
2330 SmallVector<Instruction *, 4> Insts;
2333 [&](unsigned Idx) { return this->InstMap[Idx]; });
2351 OS.indent(Depth + 2) << *Instrs[Source] << " -> \n";
2358 << TheLoop->getHeader()->getParent()->getName() << "' from "
2359 << TheLoop->getLocStr() << "\n");
2362 if (!TheLoop->isInnermost()) {
2369 if (TheLoop->getNumBackEdges() != 1) {
2380 const SCEV *ExitCount = PSE->getSymbolicMaxBackedgeTakenCount();
2389 << TheLoop->getHeader()->getName() << "\n");
2410 PtrRtChecking->Pointers.clear();
2411 PtrRtChecking->Need = false;
2413 const bool IsAnnotatedParallel = TheLoop->isAnnotatedParallel();
2417 !TheLoop->getHeader()->getParent()->hasOptSize();
2428 if (Call->isConvergent())
2432 // With both a non-vectorizable memory instruction and a convergent
2443 for (Metadata *Op : Decl->getScopeList()->operands())
2458 return any_of(CB->args(), [](Value const *Arg) {
2459 return Arg->getType()->isPointerTy();
2466 if (Call && !Call->isNoBuiltin() && Call->getCalledFunction() &&
2477 if (!Ld->isSimple() && !IsAnnotatedParallel) {
2480 LLVM_DEBUG(dbgs() << "LAA: Found a non-simple load.\n");
2486 DepChecker->addAccess(Ld);
2501 if (!St->isSimple() && !IsAnnotatedParallel) {
2504 LLVM_DEBUG(dbgs() << "LAA: Found a non-simple store.\n");
2510 DepChecker->addAccess(St);
2526 LLVM_DEBUG(dbgs() << "LAA: Found a read-only loop!\n");
2546 Value *Ptr = ST->getPointerOperand();
2555 // If we did *not* see this pointer before, insert it to the read-write
2565 if (blockNeedsPredication(ST->getParent(), TheLoop, DT))
2584 Value *Ptr = LD->getPointerOperand();
2587 // the read-write list. This allows us to vectorize expressions
2588 // such as A[i] += x; Because the address of A[i] is a read-write
2613 if (blockNeedsPredication(LD->getParent(), TheLoop, DT))
2623 // If we write (or read-write) to a single destination and there are no
2626 LLVM_DEBUG(dbgs() << "LAA: Found a write-only loop!\n");
2638 Accesses.canCheckPtrAtRT(*PtrRtChecking, PSE->getSE(), TheLoop,
2655 DepsAreSafe = DepChecker->areDepsSafe(DependentAccesses,
2658 if (!DepsAreSafe && DepChecker->shouldRetryWithRuntimeCheck()) {
2664 PtrRtChecking->reset();
2665 PtrRtChecking->Need = true;
2667 auto *SE = PSE->getSE();
2695 << (PtrRtChecking->Need ? "" : " don't")
2709 llvm::find_if(*Deps, [](const MemoryDepChecker::Dependence &D) {
2710 return MemoryDepChecker::Dependence::isSafeForVectorization(D.Type) !=
2713 if (Found == Deps->end())
2726 HasForcedDistribution = mdconst::extract<ConstantInt>(*Op)->getZExtValue();
2749 "store-to-load forwarding.";
2753 "store-to-load forwarding.";
2764 DebugLoc SourceLoc = I->getDebugLoc();
2766 SourceLoc = DD->getDebugLoc();
2775 assert(TheLoop->contains(BB) && "Unknown block used");
2778 const BasicBlock *Latch = TheLoop->getLoopLatch();
2779 return !DT->dominates(BB, Latch);
2786 const Value *CodeRegion = TheLoop->getHeader();
2787 DebugLoc DL = TheLoop->getStartLoc();
2790 CodeRegion = I->getParent();
2793 if (I->getDebugLoc())
2794 DL = I->getDebugLoc();
2803 auto *SE = PSE->getSE();
2805 // trivially loop-invariant FP values to be considered invariant.
2806 if (!SE->isSCEVable(V->getType()))
2808 const SCEV *S = SE->getSCEV(V);
2809 return SE->isLoopInvariant(S, TheLoop);
2816 const DataLayout &DL = Gep->getDataLayout();
2817 unsigned LastOperand = Gep->getNumOperands() - 1;
2818 TypeSize GEPAllocSize = DL.getTypeAllocSize(Gep->getResultElementType());
2821 while (LastOperand > 1 && match(Gep->getOperand(LastOperand), m_Zero())) {
2824 std::advance(GEPTI, LastOperand - 2);
2833 --LastOperand;
2840 /// getGEPInductionOperand. However, if there is some other non-loop-invariant
2851 for (unsigned I = 0, E = GEP->getNumOperands(); I != E; ++I)
2853 !SE->isLoopInvariant(SE->getSCEV(GEP->getOperand(I)), Lp))
2855 return GEP->getOperand(InductionOperand);
2861 auto *PtrTy = dyn_cast<PointerType>(Ptr->getType());
2862 if (!PtrTy || PtrTy->isAggregateType())
2874 const SCEV *V = SE->getSCEV(Ptr);
2879 V = C->getOperand();
2887 if (Lp != S->getLoop())
2890 V = S->getStepRecurrence(*SE);
2898 if (M->getOperand(0)->getSCEVType() != scConstant)
2901 const APInt &APStepVal = cast<SCEVConstant>(M->getOperand(0))->getAPInt();
2903 // Huge step value - give up.
2910 V = M->getOperand(1);
2916 if (!SE->isLoopInvariant(V, Lp))
2924 if (isa<SCEVUnknown>(C->getOperand()))
2936 // could broaden the scope of values returned here - to anything
2938 // computation of an interesting IV - but we chose not to as we
2941 const SCEV *StrideExpr = getStrideFromPointer(Ptr, PSE->getSE(), TheLoop);
2950 LLVM_DEBUG(dbgs() << " Chose not to due to -laa-speculate-unit-stride\n");
2955 // Stride >= Trip-Count. Such a predicate will effectively optimize a single
2956 // or zero iteration loop, as Trip-Count <= Stride == 1.
2967 const SCEV *MaxBTC = PSE->getSymbolicMaxBackedgeTakenCount();
2971 // The backedgeTakenCount is non-negative, so we zero extend MaxBTC.
2972 const DataLayout &DL = TheLoop->getHeader()->getDataLayout();
2973 uint64_t StrideTypeSizeBits = DL.getTypeSizeInBits(StrideExpr->getType());
2974 uint64_t BETypeSizeBits = DL.getTypeSizeInBits(MaxBTC->getType());
2977 ScalarEvolution *SE = PSE->getSE();
2979 CastedStride = SE->getNoopOrSignExtend(StrideExpr, MaxBTC->getType());
2981 CastedBECount = SE->getZeroExtendExpr(MaxBTC, StrideExpr->getType());
2982 const SCEV *StrideMinusBETaken = SE->getMinusSCEV(CastedStride, CastedBECount);
2985 // Stride - MaxBTC> 0
2986 if (SE->isKnownPositive(StrideMinusBETaken)) {
2999 StrideBase = C->getOperand();
3012 TTI->getRegisterBitWidth(TargetTransformInfo::RGK_FixedWidthVector);
3020 TTI->getRegisterBitWidth(TargetTransformInfo::RGK_ScalableVector);
3038 if (PtrRtChecking->Need)
3039 OS << " with run-time checks";
3047 OS.indent(Depth) << "Report: " << Report->getMsg() << "\n";
3049 if (auto *Dependences = DepChecker->getDependences()) {
3052 Dep.print(OS, Depth + 2, DepChecker->getMemoryInstructions());
3058 // List the pair of accesses need run-time checks to prove independence.
3059 PtrRtChecking->print(OS, Depth);
3071 PSE->getPredicate().print(OS, Depth);
3075 OS.indent(Depth) << "Expressions re-written:\n";
3076 PSE->print(OS, Depth);
3083 It->second =
3086 return *It->second;
3095 if (LAI->getRuntimePointerChecking()->getChecks().empty() &&
3096 LAI->getPSE().getPredicate().isAlwaysTrue())