summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2014-01-15 06:42:11 +0000
committerAndrew Trick <atrick@apple.com>2014-01-15 06:42:11 +0000
commitd5a74a754d98e74f60f340f2589d9cb6b6662988 (patch)
tree00400aeb139dc34fd139d27f0ec77dfd61324fcd /include
parent33ce2bd3de84bea9360f61c633df1ec43cb749a5 (diff)
downloadllvm-d5a74a754d98e74f60f340f2589d9cb6b6662988.tar.gz
llvm-d5a74a754d98e74f60f340f2589d9cb6b6662988.tar.bz2
llvm-d5a74a754d98e74f60f340f2589d9cb6b6662988.tar.xz
Fix PR18449: SCEV needs more precise max BECount for multi-exit loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199299 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/ScalarEvolution.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h
index 26dd4dd5fc..e53a8bffd4 100644
--- a/include/llvm/Analysis/ScalarEvolution.h
+++ b/include/llvm/Analysis/ScalarEvolution.h
@@ -253,17 +253,28 @@ namespace llvm {
/// Mark predicate values currently being processed by isImpliedCond.
DenseSet<Value*> PendingLoopPredicates;
- /// ExitLimit - Information about the number of loop iterations for
- /// which a loop exit's branch condition evaluates to the not-taken path.
- /// This is a temporary pair of exact and max expressions that are
- /// eventually summarized in ExitNotTakenInfo and BackedgeTakenInfo.
+ /// ExitLimit - Information about the number of loop iterations for which a
+ /// loop exit's branch condition evaluates to the not-taken path. This is a
+ /// temporary pair of exact and max expressions that are eventually
+ /// summarized in ExitNotTakenInfo and BackedgeTakenInfo.
+ ///
+ /// If MustExit is true, then the exit must be taken when the BECount
+ /// reaches Exact (and before surpassing Max). If MustExit is false, then
+ /// BECount may exceed Exact or Max if the loop exits via another branch. In
+ /// either case, the loop may exit early via another branch.
+ ///
+ /// MustExit is true for most cases. However, an exit guarded by an
+ /// (in)equality on a nonunit stride may be skipped.
struct ExitLimit {
const SCEV *Exact;
const SCEV *Max;
+ bool MustExit;
- /*implicit*/ ExitLimit(const SCEV *E) : Exact(E), Max(E) {}
+ /*implicit*/ ExitLimit(const SCEV *E)
+ : Exact(E), Max(E), MustExit(true) {}
- ExitLimit(const SCEV *E, const SCEV *M) : Exact(E), Max(M) {}
+ ExitLimit(const SCEV *E, const SCEV *M, bool MustExit)
+ : Exact(E), Max(M), MustExit(MustExit) {}
/// hasAnyInfo - Test whether this ExitLimit contains any computed
/// information, or whether it's all SCEVCouldNotCompute values.