[PATCH] D105921: [SCEV] Handle zero stride correctly in howManyLessThans

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 13 12:24:58 PDT 2021


efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:11675
+      auto *StartIfZero = getMinusSCEV(IV->getStart(), Stride);
+      return isLoopEntryGuardedByCond(L, Cond, StartIfZero, RHS);
+    };
----------------
reames wrote:
> efriedma wrote:
> > We make exactly the same isLoopEntryGuardedByCond() call later; can we avoid calling it twice?
> I assume you're concerned about compile time?  If so, I'd prefer to land the simple change (this one), and then revisit if needed.  I would not be surprised if the later one changed form anyways.  
As a practical matter, I'm not really concerned about compile-time here, I guess; we should be hitting wouldZeroStrideBeUB() very rarely in real code.  Just feels a little weird.  I'm okay landing this as-is for now, and we can consider refactoring once we're confident we're actually performing all the checks we need.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105921/new/

https://reviews.llvm.org/D105921



More information about the llvm-commits mailing list