@@ -857,12 +857,12 @@ static bool isNoWrap(PredicatedScalarEvolution &PSE, const SCEVAddRecExpr *AR,
857
857
if (AR->getNoWrapFlags (SCEV::NoWrapMask))
858
858
return true ;
859
859
860
- if (PSE.hasNoOverflow (Ptr, SCEVWrapPredicate::IncrementNUSW))
860
+ if (Ptr && PSE.hasNoOverflow (Ptr, SCEVWrapPredicate::IncrementNUSW))
861
861
return true ;
862
862
863
863
// The address calculation must not wrap. Otherwise, a dependence could be
864
864
// inverted.
865
- if (isNoWrapGEP (Ptr, PSE, L))
865
+ if (Ptr && isNoWrapGEP (Ptr, PSE, L))
866
866
return true ;
867
867
868
868
// An nusw getelementptr that is an AddRec cannot wrap. If it would wrap,
@@ -886,10 +886,7 @@ static bool isNoWrap(PredicatedScalarEvolution &PSE, const SCEVAddRecExpr *AR,
886
886
return true ;
887
887
}
888
888
889
- if (!Ptr)
890
- return false ;
891
-
892
- if (Assume) {
889
+ if (Ptr && Assume) {
893
890
PSE.setNoOverflow (Ptr, SCEVWrapPredicate::IncrementNUSW);
894
891
LLVM_DEBUG (dbgs () << " LAA: Pointer may wrap:\n "
895
892
<< " LAA: Pointer: " << *Ptr << " \n "
@@ -1466,9 +1463,6 @@ void AccessAnalysis::processMemAccesses() {
1466
1463
// / Check whether \p Ptr is non-wrapping GEP.
1467
1464
static bool isNoWrapGEP (Value *Ptr, PredicatedScalarEvolution &PSE,
1468
1465
const Loop *L) {
1469
- if (PSE.hasNoOverflow (Ptr, SCEVWrapPredicate::IncrementNUSW))
1470
- return true ;
1471
-
1472
1466
// Scalar evolution does not propagate the non-wrapping flags to values that
1473
1467
// are derived from a non-wrapping induction variable because non-wrapping
1474
1468
// could be flow-sensitive.
0 commit comments