[PATCH] D60662: [ConstantRange] Simplify unittests after getSetSize was removed
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 14 01:25:16 PDT 2019
nikic added inline comments.
================
Comment at: unittests/IR/ConstantRangeTest.cpp:59
break;
- ++N;
}
}
----------------
It would seem more natural to write this as a do/while loop:
```
APInt N = CR.getLower();
do {
TestFn(N);
} while (++N != CR.getUpper());
```
================
Comment at: unittests/IR/ConstantRangeTest.cpp:1468
bool RangeHasNoOverflow = false;
- APInt N1 = CR1.getLower();
- for (unsigned I1 = 0; I1 < Size1; ++I1, ++N1) {
- APInt N2 = CR2.getLower();
- for (unsigned I2 = 0; I2 < Size2; ++I2, ++N2) {
- assert(CR1.contains(N1));
- assert(CR2.contains(N2));
+ if (!CR1.isEmptySet() && !CR2.isEmptySet())
+ for (APInt N1 = CR1.getLower();;) {
----------------
Should use `ForeachNumInConstantRange` twice here (and drop the comment about sizes above).
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60662/new/
https://reviews.llvm.org/D60662
More information about the llvm-commits
mailing list