[LLVMdev] scev questions
Eugene Toder
eltoder at gmail.com
Thu Aug 22 16:28:47 PDT 2013
On Thu, Aug 22, 2013 at 7:10 PM, Nick Lewycky <nlewycky at google.com> wrote:
> But I'm not sure that we should use nsw to fix this, in spite of the fact
> that this is exactly what nsw was designed for. We know the answer even for
> the unsigned case, and we should just use that. Add a new SCEV node which
> lets us return that it's infinite in this case, and trip count X in the
> other; along the lines of "SCEVPotentiallyInfinite(m > int_max-3, sdiv(m,
> 4))".
>
I think SCEV should use nsw when possible (that's exactly what the flag is
for, as you've said). For unsigned cases, "potentially infinite" sounds
reasonable, but transforms will have to be updated to handle it. E.g. for
vectorization infinite loop is probably OK to vectorize. For closed form
computation a check will have to be inserted.
Another thought is that we can prove this particular loop is finite even if
i was unsigned. It has *a++ in the body. If a is infinitely incremented the
dereference will, at some point, cause undefined behavior.
Eugene
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130822/99d7089e/attachment.html>
More information about the llvm-dev
mailing list