@@ -857,12 +857,12 @@ static bool isNoWrap(PredicatedScalarEvolution &PSE, const SCEVAddRecExpr *AR,
857857 if (AR->getNoWrapFlags (SCEV::NoWrapMask))
858858 return true ;
859859
860- if (PSE.hasNoOverflow (Ptr, SCEVWrapPredicate::IncrementNUSW))
860+ if (Ptr && PSE.hasNoOverflow (Ptr, SCEVWrapPredicate::IncrementNUSW))
861861 return true ;
862862
863863 // The address calculation must not wrap. Otherwise, a dependence could be
864864 // inverted.
865- if (isNoWrapGEP (Ptr, PSE, L))
865+ if (Ptr && isNoWrapGEP (Ptr, PSE, L))
866866 return true ;
867867
868868 // 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,
886886 return true ;
887887 }
888888
889- if (!Ptr)
890- return false ;
891-
892- if (Assume) {
889+ if (Ptr && Assume) {
893890 PSE.setNoOverflow (Ptr, SCEVWrapPredicate::IncrementNUSW);
894891 LLVM_DEBUG (dbgs () << " LAA: Pointer may wrap:\n "
895892 << " LAA: Pointer: " << *Ptr << " \n "
@@ -1466,9 +1463,6 @@ void AccessAnalysis::processMemAccesses() {
14661463// / Check whether \p Ptr is non-wrapping GEP.
14671464static bool isNoWrapGEP (Value *Ptr, PredicatedScalarEvolution &PSE,
14681465 const Loop *L) {
1469- if (PSE.hasNoOverflow (Ptr, SCEVWrapPredicate::IncrementNUSW))
1470- return true ;
1471-
14721466 // Scalar evolution does not propagate the non-wrapping flags to values that
14731467 // are derived from a non-wrapping induction variable because non-wrapping
14741468 // could be flow-sensitive.
0 commit comments