@@ -1018,8 +1018,8 @@ getStrideFromAddRec(const SCEVAddRecExpr *AR, const Loop *Lp, Type *AccessTy,
10181018// / informating from the IR pointer value to determine no-wrap.
10191019static bool isNoWrap (PredicatedScalarEvolution &PSE, const SCEVAddRecExpr *AR,
10201020 Value *Ptr, Type *AccessTy, const Loop *L, bool Assume,
1021- std::optional< int64_t > Stride = std:: nullopt ,
1022- DominatorTree *DT = nullptr ) {
1021+ const DominatorTree &DT ,
1022+ std::optional< int64_t > Stride = std:: nullopt ) {
10231023 // FIXME: This should probably only return true for NUW.
10241024 if (AR->getNoWrapFlags (SCEV::NoWrapMask))
10251025 return true ;
@@ -1037,15 +1037,11 @@ static bool isNoWrap(PredicatedScalarEvolution &PSE, const SCEVAddRecExpr *AR,
10371037 // For the above reasoning to apply, the pointer must be dereferenced in
10381038 // every iteration.
10391039 if (L->getHeader () == L->getLoopLatch () ||
1040- any_of (GEP->users (), [L, DT,GEP](User *U) {
1040+ any_of (GEP->users (), [L, & DT, GEP](User *U) {
10411041 if (getLoadStorePointerOperand (U) != GEP)
10421042 return false ;
10431043 BasicBlock *UserBB = cast<Instruction>(U)->getParent ();
1044- if (DT && !LoopAccessInfo::blockNeedsPredication (UserBB, L, DT))
1045- return true ;
1046- return UserBB == L->getHeader () ||
1047- (L->getExitingBlock () == L->getLoopLatch () &&
1048- UserBB == L->getLoopLatch ());
1044+ return !LoopAccessInfo::blockNeedsPredication (UserBB, L, &DT);
10491045 }))
10501046 return true ;
10511047 }
@@ -1311,7 +1307,7 @@ bool AccessAnalysis::createCheckForAccess(
13111307 }
13121308
13131309 if (!isNoWrap (PSE, AR, RTCheckPtrs.size () == 1 ? Ptr : nullptr , AccessTy,
1314- TheLoop, Assume, {}, & DT))
1310+ TheLoop, Assume, DT))
13151311 return false ;
13161312 }
13171313
@@ -1648,7 +1644,7 @@ llvm::getPtrStride(PredicatedScalarEvolution &PSE, Type *AccessTy, Value *Ptr,
16481644 if (!ShouldCheckWrap || !Stride)
16491645 return Stride;
16501646
1651- if (isNoWrap (PSE, AR, Ptr, AccessTy, Lp, Assume, Stride, DT ))
1647+ if (isNoWrap (PSE, AR, Ptr, AccessTy, Lp, Assume, *DT, Stride ))
16521648 return Stride;
16531649
16541650 LLVM_DEBUG (
0 commit comments