[llvm] db4874c - [ConstantFPRange][UnitTests] Guard exhaustive checks by `EXPENSIVE_CHECKS` (#111276)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 7 19:39:50 PDT 2024
Author: Yingwei Zheng
Date: 2024-10-08T10:39:46+08:00
New Revision: db4874c2fc0b34e8959ff0ac455bff5f54fbd52b
URL: https://github.com/llvm/llvm-project/commit/db4874c2fc0b34e8959ff0ac455bff5f54fbd52b
DIFF: https://github.com/llvm/llvm-project/commit/db4874c2fc0b34e8959ff0ac455bff5f54fbd52b.diff
LOG: [ConstantFPRange][UnitTests] Guard exhaustive checks by `EXPENSIVE_CHECKS` (#111276)
Addresses comment
https://github.com/llvm/llvm-project/pull/111056#issuecomment-2393951499.
Added:
Modified:
llvm/unittests/IR/ConstantFPRangeTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/IR/ConstantFPRangeTest.cpp b/llvm/unittests/IR/ConstantFPRangeTest.cpp
index 158d08f9b77a0a..3c6e468b05bfda 100644
--- a/llvm/unittests/IR/ConstantFPRangeTest.cpp
+++ b/llvm/unittests/IR/ConstantFPRangeTest.cpp
@@ -435,6 +435,7 @@ TEST_F(ConstantFPRangeTest, FPClassify) {
EXPECT_EQ(SomePos.getSignBit(), false);
EXPECT_EQ(SomeNeg.getSignBit(), true);
+#if defined(EXPENSIVE_CHECKS)
EnumerateConstantFPRanges(
[](const ConstantFPRange &CR) {
unsigned Mask = fcNone;
@@ -458,6 +459,7 @@ TEST_F(ConstantFPRangeTest, FPClassify) {
EXPECT_EQ(Mask, CR.classify()) << CR;
},
/*Exhaustive=*/true);
+#endif
}
TEST_F(ConstantFPRangeTest, Print) {
@@ -500,6 +502,36 @@ TEST_F(ConstantFPRangeTest, MismatchedSemantics) {
#endif
TEST_F(ConstantFPRangeTest, makeAllowedFCmpRegion) {
+ EXPECT_EQ(ConstantFPRange::makeAllowedFCmpRegion(
+ FCmpInst::FCMP_OLE,
+ ConstantFPRange::getNonNaN(APFloat(1.0), APFloat(2.0))),
+ ConstantFPRange::getNonNaN(APFloat::getInf(Sem, /*Negative=*/true),
+ APFloat(2.0)));
+ EXPECT_EQ(
+ ConstantFPRange::makeAllowedFCmpRegion(
+ FCmpInst::FCMP_OLT,
+ ConstantFPRange::getNonNaN(APFloat(1.0),
+ APFloat::getInf(Sem, /*Negative=*/false))),
+ ConstantFPRange::getNonNaN(APFloat::getInf(Sem, /*Negative=*/true),
+ APFloat::getLargest(Sem, /*Negative=*/false)));
+ EXPECT_EQ(
+ ConstantFPRange::makeAllowedFCmpRegion(
+ FCmpInst::FCMP_OGT,
+ ConstantFPRange::getNonNaN(APFloat::getZero(Sem, /*Negative=*/true),
+ APFloat(2.0))),
+ ConstantFPRange::getNonNaN(APFloat::getSmallest(Sem, /*Negative=*/false),
+ APFloat::getInf(Sem, /*Negative=*/false)));
+ EXPECT_EQ(ConstantFPRange::makeAllowedFCmpRegion(
+ FCmpInst::FCMP_OGE,
+ ConstantFPRange::getNonNaN(APFloat(1.0), APFloat(2.0))),
+ ConstantFPRange::getNonNaN(
+ APFloat(1.0), APFloat::getInf(Sem, /*Negative=*/false)));
+ EXPECT_EQ(ConstantFPRange::makeAllowedFCmpRegion(
+ FCmpInst::FCMP_OEQ,
+ ConstantFPRange::getNonNaN(APFloat(1.0), APFloat(2.0))),
+ ConstantFPRange::getNonNaN(APFloat(1.0), APFloat(2.0)));
+
+#if defined(EXPENSIVE_CHECKS)
for (auto Pred : FCmpInst::predicates()) {
EnumerateConstantFPRanges(
[Pred](const ConstantFPRange &CR) {
@@ -529,6 +561,7 @@ TEST_F(ConstantFPRangeTest, makeAllowedFCmpRegion) {
},
/*Exhaustive=*/false);
}
+#endif
}
} // anonymous namespace
More information about the llvm-commits
mailing list