[PATCH] D60264: [ConstantRange] Add isNegative() and isNonNegative() methods

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 4 08:31:49 PDT 2019


nikic marked an inline comment as done.
nikic added inline comments.


================
Comment at: llvm/unittests/IR/ConstantRangeTest.cpp:1664
+    EXPECT_EQ(AllNonNegative, CR.isAllNonNegative());
+  });
+}
----------------
lebedev.ri wrote:
> Hmm, can we also check that
> ```
> if(!CR.isEmptySet() && !CR.isFullSet())
>   EXPECT_NE(AllNegative, AllNonNegative);
> ```
> ?
> 
This doesn't hold in general, as AllNegative and AllNonNegative may both be false for ranges that cross zero (but are not necessarily full). E.g. `[-5, 6)` is neither negative nor non-negative.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60264/new/

https://reviews.llvm.org/D60264





More information about the llvm-commits mailing list