diff options
author | William S. Moses <gh@wsmoses.com> | 2022-01-24 20:02:53 -0500 |
---|---|---|
committer | William S. Moses <gh@wsmoses.com> | 2022-01-28 17:41:08 -0500 |
commit | 99d2582164c4bc8f10c3e3c20dd3690243ad49ba (patch) | |
tree | 9caffa8a3dc09812cba11c68977963a3da8972f2 /clang/lib/Frontend/InitPreprocessor.cpp | |
parent | 354ec4af749ccd910a1cffc5e9cce2bb93239b9b (diff) | |
download | llvm-99d2582164c4bc8f10c3e3c20dd3690243ad49ba.zip llvm-99d2582164c4bc8f10c3e3c20dd3690243ad49ba.tar.gz llvm-99d2582164c4bc8f10c3e3c20dd3690243ad49ba.tar.bz2 |
[ScalarEvolution] Handle <= and >= in non infinite loops
Extend scalar evolution to handle >= and <= if a loop is known to be finite and the induction variable guards the condition. Specifically, with these assumptions lhs <= rhs is equivalent to lhs < rhs + 1 and lhs >= rhs to lhs > rhs -1.
In the case of lhs <= rhs, this is true since the only case these are not equivalent
is when rhs == unsigned/signed intmax, which would have resulted in an infinite loop.
In the case of lhs >= rhs, this is true since the only case these are not equivalent
is when rhs == unsigned/signed intmin, which would again have resulted in an infinite loop.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D118090
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
0 files changed, 0 insertions, 0 deletions