[llvm] dffef04 - [IR][ADT] Remove `APFloat/Type::isIEEE` (#130496)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 14 02:03:42 PDT 2025
Author: Yingwei Zheng
Date: 2025-04-14T17:03:39+08:00
New Revision: dffef041d568e945efbd78c8eb1a3881b67cd405
URL: https://github.com/llvm/llvm-project/commit/dffef041d568e945efbd78c8eb1a3881b67cd405
DIFF: https://github.com/llvm/llvm-project/commit/dffef041d568e945efbd78c8eb1a3881b67cd405.diff
LOG: [IR][ADT] Remove `APFloat/Type::isIEEE` (#130496)
Address comment
https://github.com/llvm/llvm-project/pull/130477#issuecomment-2708801892.
Added:
Modified:
llvm/include/llvm/ADT/APFloat.h
llvm/include/llvm/IR/Type.h
llvm/include/llvm/SandboxIR/Type.h
llvm/lib/IR/Type.cpp
llvm/unittests/SandboxIR/TypesTest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h
index 01e51accec9df..ed49380cfc05f 100644
--- a/llvm/include/llvm/ADT/APFloat.h
+++ b/llvm/include/llvm/ADT/APFloat.h
@@ -1465,7 +1465,6 @@ class APFloat : public APFloatBase {
bool isSmallest() const { APFLOAT_DISPATCH_ON_SEMANTICS(isSmallest()); }
bool isLargest() const { APFLOAT_DISPATCH_ON_SEMANTICS(isLargest()); }
bool isInteger() const { APFLOAT_DISPATCH_ON_SEMANTICS(isInteger()); }
- bool isIEEE() const { return usesLayout<IEEEFloat>(getSemantics()); }
bool isSmallestNormalized() const {
APFLOAT_DISPATCH_ON_SEMANTICS(isSmallestNormalized());
diff --git a/llvm/include/llvm/IR/Type.h b/llvm/include/llvm/IR/Type.h
index 6dadf158a739f..a4c0648a9197e 100644
--- a/llvm/include/llvm/IR/Type.h
+++ b/llvm/include/llvm/IR/Type.h
@@ -165,8 +165,8 @@ class Type {
bool isPPC_FP128Ty() const { return getTypeID() == PPC_FP128TyID; }
/// Return true if this is a well-behaved IEEE-like type, which has a IEEE
- /// compatible layout as defined by APFloat::isIEEE(), and does not have
- /// non-IEEE values, such as x86_fp80's unnormal values.
+ /// compatible layout, and does not have non-IEEE values, such as x86_fp80's
+ /// unnormal values.
bool isIEEELikeFPTy() const {
switch (getTypeID()) {
case DoubleTyID:
@@ -346,10 +346,6 @@ class Type {
/// ppc long double), this method returns -1.
int getFPMantissaWidth() const;
- /// Return whether the type is IEEE compatible, as defined by the eponymous
- /// method in APFloat.
- bool isIEEE() const;
-
/// If this is a vector type, return the element type, otherwise return
/// 'this'.
inline Type *getScalarType() const {
diff --git a/llvm/include/llvm/SandboxIR/Type.h b/llvm/include/llvm/SandboxIR/Type.h
index 9ece89fcbd66c..46032ba1084ff 100644
--- a/llvm/include/llvm/SandboxIR/Type.h
+++ b/llvm/include/llvm/SandboxIR/Type.h
@@ -120,8 +120,8 @@ class Type {
bool isPPC_FP128Ty() const { return LLVMTy->isPPC_FP128Ty(); }
/// Return true if this is a well-behaved IEEE-like type, which has a IEEE
- /// compatible layout as defined by APFloat::isIEEE(), and does not have
- /// non-IEEE values, such as x86_fp80's unnormal values.
+ /// compatible layout, and does not have non-IEEE values, such as x86_fp80's
+ /// unnormal values.
bool isIEEELikeFPTy() const { return LLVMTy->isIEEELikeFPTy(); }
/// Return true if this is one of the floating-point types
@@ -262,10 +262,6 @@ class Type {
/// ppc long double), this method returns -1.
int getFPMantissaWidth() const { return LLVMTy->getFPMantissaWidth(); }
- /// Return whether the type is IEEE compatible, as defined by the eponymous
- /// method in APFloat.
- bool isIEEE() const { return LLVMTy->isIEEE(); }
-
/// If this is a vector type, return the element type, otherwise return
/// 'this'.
Type *getScalarType() const;
diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp
index 34732f75ebecb..884609e734298 100644
--- a/llvm/lib/IR/Type.cpp
+++ b/llvm/lib/IR/Type.cpp
@@ -117,10 +117,6 @@ const fltSemantics &Type::getFltSemantics() const {
}
}
-bool Type::isIEEE() const {
- return APFloat::getZero(getFltSemantics()).isIEEE();
-}
-
bool Type::isScalableTargetExtTy() const {
if (auto *TT = dyn_cast<TargetExtType>(this))
return isa<ScalableVectorType>(TT->getLayoutType());
diff --git a/llvm/unittests/SandboxIR/TypesTest.cpp b/llvm/unittests/SandboxIR/TypesTest.cpp
index d87f034bd047e..880caa7137a44 100644
--- a/llvm/unittests/SandboxIR/TypesTest.cpp
+++ b/llvm/unittests/SandboxIR/TypesTest.cpp
@@ -180,8 +180,8 @@ define void @foo(i32 %v0) {
EXPECT_EQ(VecTy32x2->getScalarSizeInBits(), 32u);
// Check getFPMantissaWidth().
EXPECT_EQ(FloatTy->getFPMantissaWidth(), LLVMFloatTy->getFPMantissaWidth());
- // Check isIEEE().
- EXPECT_EQ(FloatTy->isIEEE(), LLVMFloatTy->isIEEE());
+ // Check isIEEELikeFPTy().
+ EXPECT_EQ(FloatTy->isIEEELikeFPTy(), LLVMFloatTy->isIEEELikeFPTy());
// Check getScalarType().
EXPECT_EQ(
Ctx.getType(llvm::FixedVectorType::get(LLVMInt32Ty, 8u))->getScalarType(),
More information about the llvm-commits
mailing list