[PATCH] D103118: [SCEV] Compute exit counts for unsigned IVs using mustprogress semantics
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 3 14:45:49 PDT 2021
efriedma added inline comments.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:11398
+ if (getURemExpr(MaxVal, Stride) != StrideMinusOne)
+ return false;
+
----------------
reames wrote:
> 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. :)
>
> I'm not really following here. I *think* you're asking if we can simply save the no-self-wrap somewhere right?
I was more thinking of computing a max backedge taken count in the case where we can't prove no-self-wrap (i.e. Stride=3).
What you're describing might be useful too.
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