[llvm] [DA] getBackedgeTakenCount in isKnownLessThan can return CouldNotCompute (PR #162495)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 10 01:51:53 PDT 2025


================
@@ -1184,6 +1184,8 @@ bool DependenceInfo::isKnownLessThan(const SCEV *S, const SCEV *Size) const {
   if (const SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(S))
     if (AddRec->isAffine() && AddRec->hasNoSignedWrap()) {
       const SCEV *BECount = SE->getBackedgeTakenCount(AddRec->getLoop());
+      if (isa<SCEVCouldNotCompute>(BECount))
+        return false;
----------------
nikic wrote:

Note that this is also going to skip the base case below.

https://github.com/llvm/llvm-project/pull/162495


More information about the llvm-commits mailing list