1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[SCEV] Add a comment about invariant in howManyLessThans

This commit is contained in:
Philip Reames 2021-07-26 16:39:11 -07:00
parent 18108c50ec
commit b21820b66f

View File

@ -11728,6 +11728,15 @@ ScalarEvolution::howManyLessThans(const SCEV *LHS, const SCEV *RHS,
return getCouldNotCompute(); 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(); const SCEV *Start = IV->getStart();
// Preserve pointer-typed Start/RHS to pass to isLoopEntryGuardedByCond. // Preserve pointer-typed Start/RHS to pass to isLoopEntryGuardedByCond.