[llvm] f82f39b - [SCEV] Add a comment about invariant in howManyLessThans
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 26 16:42:47 PDT 2021
Author: Philip Reames
Date: 2021-07-26T16:39:26-07:00
New Revision: f82f39b9cfc9a807380ebb2348c1cf16610e1e87
URL: https://github.com/llvm/llvm-project/commit/f82f39b9cfc9a807380ebb2348c1cf16610e1e87
DIFF: https://github.com/llvm/llvm-project/commit/f82f39b9cfc9a807380ebb2348c1cf16610e1e87.diff
LOG: [SCEV] Add a comment about invariant in howManyLessThans
Added:
Modified:
llvm/lib/Analysis/ScalarEvolution.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index df38a850c287..f22d834b5e57 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -11728,6 +11728,15 @@ ScalarEvolution::howManyLessThans(const SCEV *LHS, const SCEV *RHS,
return getCouldNotCompute();
}
+ // On all paths just preceeding, we established the following invariant:
+ // IV can be assumed not to overflow up to and including the exiting
+ // iteration. We proved this in one of two ways:
+ // 1) We can show overflow doesn't occur before the exiting iteration
+ // 1a) canIVOverflowOnLT, and b) step of one
+ // 2) We can show that if overflow occurs, the loop must execute UB
+ // before any possible exit.
+ // Note that we have not yet proved RHS invariant (in general).
+
const SCEV *Start = IV->getStart();
// Preserve pointer-typed Start/RHS to pass to isLoopEntryGuardedByCond.
More information about the llvm-commits
mailing list