Skip to content

[ConstantFPRange] Remove ConstantFPRange::toKnownFPClass #109960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 25, 2024

Conversation

dtcxzyw
Copy link
Member

@dtcxzyw dtcxzyw commented Sep 25, 2024

Addresses comment #86483 (review).

@llvmbot
Copy link
Member

llvmbot commented Sep 25, 2024

@llvm/pr-subscribers-llvm-ir

Author: Yingwei Zheng (dtcxzyw)

Changes

Addresses comment #86483 (review).


Full diff: https://github.com/llvm/llvm-project/pull/109960.diff

3 Files Affected:

  • (modified) llvm/include/llvm/IR/ConstantFPRange.h (-3)
  • (modified) llvm/lib/IR/ConstantFPRange.cpp (-7)
  • (modified) llvm/unittests/IR/ConstantFPRangeTest.cpp (-3)
diff --git a/llvm/include/llvm/IR/ConstantFPRange.h b/llvm/include/llvm/IR/ConstantFPRange.h
index 23f0e8b8e0d134..67f9f945d748ba 100644
--- a/llvm/include/llvm/IR/ConstantFPRange.h
+++ b/llvm/include/llvm/IR/ConstantFPRange.h
@@ -175,9 +175,6 @@ class [[nodiscard]] ConstantFPRange {
   /// Return the FPClassTest which will return true for the value.
   FPClassTest classify() const;
 
-  /// Return known floating-point classes for values in this range.
-  KnownFPClass toKnownFPClass() const;
-
   /// Print out the bounds to a stream.
   void print(raw_ostream &OS) const;
 
diff --git a/llvm/lib/IR/ConstantFPRange.cpp b/llvm/lib/IR/ConstantFPRange.cpp
index 58aab353b43939..6b3610f5cdfe8c 100644
--- a/llvm/lib/IR/ConstantFPRange.cpp
+++ b/llvm/lib/IR/ConstantFPRange.cpp
@@ -196,13 +196,6 @@ FPClassTest ConstantFPRange::classify() const {
   return static_cast<FPClassTest>(Mask);
 }
 
-KnownFPClass ConstantFPRange::toKnownFPClass() const {
-  KnownFPClass Result;
-  Result.KnownFPClasses = classify();
-  Result.SignBit = getSignBit();
-  return Result;
-}
-
 void ConstantFPRange::print(raw_ostream &OS) const {
   if (isFullSet())
     OS << "full-set";
diff --git a/llvm/unittests/IR/ConstantFPRangeTest.cpp b/llvm/unittests/IR/ConstantFPRangeTest.cpp
index bf6ea95c00e22e..5a00c6b11d12b5 100644
--- a/llvm/unittests/IR/ConstantFPRangeTest.cpp
+++ b/llvm/unittests/IR/ConstantFPRangeTest.cpp
@@ -363,14 +363,11 @@ TEST_F(ConstantFPRangeTest, FPClassify) {
   EXPECT_EQ(SomeNeg.classify(), fcNegFinite);
   EXPECT_EQ(PosInf.classify(), fcPosInf);
   EXPECT_EQ(NegInf.classify(), fcNegInf);
-  EXPECT_TRUE(SomePos.toKnownFPClass().cannotBeOrderedLessThanZero());
   EXPECT_EQ(Finite.getSignBit(), std::nullopt);
   EXPECT_EQ(PosZero.getSignBit(), false);
   EXPECT_EQ(NegZero.getSignBit(), true);
   EXPECT_EQ(SomePos.getSignBit(), false);
   EXPECT_EQ(SomeNeg.getSignBit(), true);
-  EXPECT_EQ(SomePos.toKnownFPClass().SignBit, false);
-  EXPECT_EQ(SomeNeg.toKnownFPClass().SignBit, true);
 
   EnumerateConstantFPRanges(
       [](const ConstantFPRange &CR) {

@@ -196,13 +196,6 @@ FPClassTest ConstantFPRange::classify() const {
return static_cast<FPClassTest>(Mask);
}

KnownFPClass ConstantFPRange::toKnownFPClass() const {
KnownFPClass Result;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could probably move KnownFPClass into ADT

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which reminds me, we for some reason have llvm/ADT/FloatingPointMode.h, and llvm/IR/FPEnv.h. I can't tell if there's some intentional split here

@dtcxzyw dtcxzyw merged commit 59693ea into llvm:main Sep 25, 2024
6 of 8 checks passed
@dtcxzyw dtcxzyw deleted the cfr-remove-dep branch September 25, 2024 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants