[PATCH] D90924: [ConstantRange] Sign-flipping of signedness-invariant comparisons
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 31 01:42:38 PDT 2021
nikic added inline comments.
================
Comment at: llvm/lib/IR/ConstantRange.cpp:171
+
+ return false;
+}
----------------
This implementation reads really confused to me. You should be able to reduce it to just:
```
if (CR1.isEmptySet() || CR2.isEmptySet())
return true;
return (CR1.isAllNonNegative() && CR2.isAllNonNegative()) ||
(CR1.isAllNegative() && CR2.isAllNegative());
```
I checked that this still passes your tests.
================
Comment at: llvm/unittests/IR/ConstantRangeTest.cpp:2535
+ for (auto Pred : seq((unsigned)ICmpInst::Predicate::FIRST_ICMP_PREDICATE,
+ ICmpInst::Predicate::LAST_ICMP_PREDICATE + 1)) {
+ if (ICmpInst::isEquality((ICmpInst::Predicate)Pred))
----------------
Use `seq_inclusive()` to avoid the back and forth casts?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90924/new/
https://reviews.llvm.org/D90924
More information about the llvm-commits
mailing list