Skip to content

Commit 013ed31

Browse files
committed
!fixup make DT non-optional
1 parent a7f0b09 commit 013ed31

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

llvm/lib/Analysis/LoopAccessAnalysis.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,8 +1018,8 @@ getStrideFromAddRec(const SCEVAddRecExpr *AR, const Loop *Lp, Type *AccessTy,
10181018
/// informating from the IR pointer value to determine no-wrap.
10191019
static 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

Comments
 (0)