[PATCH] D103118: [SCEV] Compute exit counts for unsigned IVs using mustprogress semantics

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 3 14:24:39 PDT 2021


reames added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:11398
+      if (getURemExpr(MaxVal, Stride) != StrideMinusOne)
+        return false;
+
----------------
efriedma wrote:
> Could you just check that Stride is a power of 2 here? This seems overly complicated.
> 
> Could you separate out checking "there must be some value of LHS that forces the loop to exit" from "the IV can't wrap"?  We can use the former to compute a max backedge taken count even if we can't prove the IV doesn't wrap.
> Could you just check that Stride is a power of 2 here? This seems overly complicated.
Sure, don't really care here, but I'll make the change.

> Could you separate out checking "there must be some value of LHS that forces the loop to exit" from "the IV can't wrap"?  We can use the former to compute a max backedge taken count even if we can't prove the IV doesn't wrap.
I'm not really following here.  I *think* you're asking if we can simply save the no-self-wrap somewhere right?

I agree that in principal, no-self-wrap is enough to prove a max exit count, but in practice, the current code can't do that.  I would strongly prefer to work incrementally here if that is what you're suggesting.  :)



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103118



More information about the llvm-commits mailing list