diff options
author | Guillaume Chatelet <gchatelet@google.com> | 2021-07-21 12:48:09 +0000 |
---|---|---|
committer | Guillaume Chatelet <gchatelet@google.com> | 2021-07-21 12:48:53 +0000 |
commit | d6da02d952470ac976824da9aefdfb13ea1dde34 (patch) | |
tree | 61046584db1d1310be2f449bf24608521c5ed5d7 /llvm/unittests/IR/ConstantRangeTest.cpp | |
parent | 59db3a5df918701f32fd6a8de858da3a23a2424d (diff) | |
download | llvm-d6da02d952470ac976824da9aefdfb13ea1dde34.zip llvm-d6da02d952470ac976824da9aefdfb13ea1dde34.tar.gz llvm-d6da02d952470ac976824da9aefdfb13ea1dde34.tar.bz2 |
[llvm] Add enum iteration to Sequence
This patch allows iterating typed enum via the ADT/Sequence utility.
It also changes the original design to better separate concerns:
- `StrongInt` only deals with safe `intmax_t` operations,
- `SafeIntIterator` presents the iterator and reverse iterator
interface but only deals with safe `StrongInt` internally.
- `iota_range` only deals with `SafeIntIterator` internally.
This design ensures that operations are always valid. In particular,
"Out of bounds" assertions fire when:
- the `value_type` is not representable as an `intmax_t`
- iterator operations make internal computation underflow/overflow
- the internal representation cannot be converted back to `value_type`
Differential Revision: https://reviews.llvm.org/D106279
Diffstat (limited to 'llvm/unittests/IR/ConstantRangeTest.cpp')
-rw-r--r-- | llvm/unittests/IR/ConstantRangeTest.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/unittests/IR/ConstantRangeTest.cpp b/llvm/unittests/IR/ConstantRangeTest.cpp index f8816e4..8eca261 100644 --- a/llvm/unittests/IR/ConstantRangeTest.cpp +++ b/llvm/unittests/IR/ConstantRangeTest.cpp @@ -1551,9 +1551,9 @@ void ICmpTestImpl(CmpInst::Predicate Pred) { } TEST(ConstantRange, ICmp) { - for (auto Pred : seq<unsigned>(CmpInst::Predicate::FIRST_ICMP_PREDICATE, - 1 + CmpInst::Predicate::LAST_ICMP_PREDICATE)) - ICmpTestImpl((CmpInst::Predicate)Pred); + for (auto Pred : seq_inclusive(CmpInst::Predicate::FIRST_ICMP_PREDICATE, + CmpInst::Predicate::LAST_ICMP_PREDICATE)) + ICmpTestImpl(Pred); } TEST(ConstantRange, MakeGuaranteedNoWrapRegion) { |