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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions llvm/include/llvm/IR/ConstantFPRange.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 0 additions & 8 deletions llvm/lib/IR/ConstantFPRange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "llvm/IR/ConstantFPRange.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
Expand Down Expand Up @@ -196,13 +195,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

Result.KnownFPClasses = classify();
Result.SignBit = getSignBit();
return Result;
}

void ConstantFPRange::print(raw_ostream &OS) const {
if (isFullSet())
OS << "full-set";
Expand Down
8 changes: 0 additions & 8 deletions llvm/unittests/IR/ConstantFPRangeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@
//===----------------------------------------------------------------------===//

#include "llvm/IR/ConstantFPRange.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Operator.h"
#include "llvm/Support/KnownBits.h"
#include "gtest/gtest.h"

using namespace llvm;
Expand Down Expand Up @@ -363,14 +358,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) {
Expand Down
Loading