aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorEli Friedman <efriedma@quicinc.com>2021-06-29 15:22:13 -0700
committerEli Friedman <efriedma@quicinc.com>2021-07-08 10:09:55 -0700
commit5b350183cdabd83573bc760ddf513f3e1d991bcb (patch)
tree751780eb8c4af2553b365370d6fd4561160bc3df /llvm/lib/Support/CommandLine.cpp
parent769e782793391a1ee0d257c8b0c6f43a02321e22 (diff)
downloadllvm-5b350183cdabd83573bc760ddf513f3e1d991bcb.zip
llvm-5b350183cdabd83573bc760ddf513f3e1d991bcb.tar.gz
llvm-5b350183cdabd83573bc760ddf513f3e1d991bcb.tar.bz2
[ScalarEvolution] Fix overflow in computeBECount.
There are two issues with the current implementation of computeBECount: 1. It doesn't account for the possibility that adding "Stride - 1" to Delta might overflow. For almost all loops, it doesn't, but it's not actually proven anywhere. 2. It doesn't account for the possibility that Stride is zero. If Delta is zero, the backedge is never taken; the value of Stride isn't relevant. To handle this, we have to make sure that the expression returned by computeBECount evaluates to zero. To deal with this, add two new checks: 1. Use a variety of tricks to try to prove that the addition doesn't overflow. If the proof is impossible, use an alternate sequence which never overflows. 2. Use umax(Stride, 1) to handle the possibility that Stride is zero. Differential Revision: https://reviews.llvm.org/D105216
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
0 files changed, 0 insertions, 0 deletions