[llvm] [ConstantFPRange] Implement `ConstantFPRange::makeAllowedFCmpRegion` (PR #110082)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 30 05:59:36 PDT 2024
================
@@ -425,4 +442,32 @@ TEST_F(ConstantFPRangeTest, MismatchedSemantics) {
#endif
#endif
+TEST_F(ConstantFPRangeTest, makeAllowedFCmpRegion) {
+ for (auto Pred : FCmpInst::predicates()) {
+ EnumerateConstantFPRanges(
+ [Pred](const ConstantFPRange &CR) {
+ ConstantFPRange Res =
+ ConstantFPRange::makeAllowedFCmpRegion(Pred, CR);
+ ConstantFPRange Optimal =
+ ConstantFPRange::getEmpty(CR.getSemantics());
+ EnumerateValuesInConstantFPRange(
+ ConstantFPRange::getFull(CR.getSemantics()),
+ [&](const APFloat &V) {
+ if (AnyOfValueInConstantFPRange(CR, [&](const APFloat &U) {
+ return FCmpInst::compare(V, U, Pred);
+ }))
+ Optimal = Optimal.unionWith(ConstantFPRange(V));
+ });
+
+ ASSERT_TRUE(Res.contains(Optimal))
----------------
dtcxzyw wrote:
I use this in the earlier version to avoid reporting tons of assertion failures. Will fix.
https://github.com/llvm/llvm-project/pull/110082
More information about the llvm-commits
mailing list