Skip to content

Commit d9a9ecd

Browse files
committed
[IR][ADT] Remove isIEEE
1 parent 029e102 commit d9a9ecd

File tree

6 files changed

+9
-22
lines changed

6 files changed

+9
-22
lines changed

llvm/include/llvm/ADT/APFloat.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1462,7 +1462,6 @@ class APFloat : public APFloatBase {
14621462
bool isSmallest() const { APFLOAT_DISPATCH_ON_SEMANTICS(isSmallest()); }
14631463
bool isLargest() const { APFLOAT_DISPATCH_ON_SEMANTICS(isLargest()); }
14641464
bool isInteger() const { APFLOAT_DISPATCH_ON_SEMANTICS(isInteger()); }
1465-
bool isIEEE() const { return usesLayout<IEEEFloat>(getSemantics()); }
14661465

14671466
bool isSmallestNormalized() const {
14681467
APFLOAT_DISPATCH_ON_SEMANTICS(isSmallestNormalized());

llvm/include/llvm/IR/Type.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ class Type {
165165
bool isPPC_FP128Ty() const { return getTypeID() == PPC_FP128TyID; }
166166

167167
/// Return true if this is a well-behaved IEEE-like type, which has a IEEE
168-
/// compatible layout as defined by APFloat::isIEEE(), and does not have
169-
/// non-IEEE values, such as x86_fp80's unnormal values.
168+
/// compatible layout, and does not have non-IEEE values, such as x86_fp80's
169+
/// unnormal values.
170170
bool isIEEELikeFPTy() const {
171171
switch (getTypeID()) {
172172
case DoubleTyID:
@@ -346,10 +346,6 @@ class Type {
346346
/// ppc long double), this method returns -1.
347347
int getFPMantissaWidth() const;
348348

349-
/// Return whether the type is IEEE compatible, as defined by the eponymous
350-
/// method in APFloat.
351-
bool isIEEE() const;
352-
353349
/// If this is a vector type, return the element type, otherwise return
354350
/// 'this'.
355351
inline Type *getScalarType() const {

llvm/include/llvm/SandboxIR/Type.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ class Type {
116116
bool isPPC_FP128Ty() const { return LLVMTy->isPPC_FP128Ty(); }
117117

118118
/// Return true if this is a well-behaved IEEE-like type, which has a IEEE
119-
/// compatible layout as defined by APFloat::isIEEE(), and does not have
120-
/// non-IEEE values, such as x86_fp80's unnormal values.
119+
/// compatible layout, and does not have non-IEEE values, such as x86_fp80's
120+
/// unnormal values.
121121
bool isIEEELikeFPTy() const { return LLVMTy->isIEEELikeFPTy(); }
122122

123123
/// Return true if this is one of the floating-point types
@@ -258,10 +258,6 @@ class Type {
258258
/// ppc long double), this method returns -1.
259259
int getFPMantissaWidth() const { return LLVMTy->getFPMantissaWidth(); }
260260

261-
/// Return whether the type is IEEE compatible, as defined by the eponymous
262-
/// method in APFloat.
263-
bool isIEEE() const { return LLVMTy->isIEEE(); }
264-
265261
/// If this is a vector type, return the element type, otherwise return
266262
/// 'this'.
267263
Type *getScalarType() const;

llvm/lib/IR/Type.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,6 @@ const fltSemantics &Type::getFltSemantics() const {
117117
}
118118
}
119119

120-
bool Type::isIEEE() const {
121-
return APFloat::getZero(getFltSemantics()).isIEEE();
122-
}
123-
124120
bool Type::isScalableTargetExtTy() const {
125121
if (auto *TT = dyn_cast<TargetExtType>(this))
126122
return isa<ScalableVectorType>(TT->getLayoutType());

llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2645,7 +2645,7 @@ Instruction *InstCombinerImpl::visitAnd(BinaryOperator &I) {
26452645
!Builder.GetInsertBlock()->getParent()->hasFnAttribute(
26462646
Attribute::NoImplicitFloat)) {
26472647
Type *EltTy = CastOp->getType()->getScalarType();
2648-
if (EltTy->isFloatingPointTy() && EltTy->isIEEE()) {
2648+
if (EltTy->isIEEELikeFPTy()) {
26492649
Value *FAbs = Builder.CreateUnaryIntrinsic(Intrinsic::fabs, CastOp);
26502650
return new BitCastInst(FAbs, I.getType());
26512651
}
@@ -4057,7 +4057,7 @@ Instruction *InstCombinerImpl::visitOr(BinaryOperator &I) {
40574057
!Builder.GetInsertBlock()->getParent()->hasFnAttribute(
40584058
Attribute::NoImplicitFloat)) {
40594059
Type *EltTy = CastOp->getType()->getScalarType();
4060-
if (EltTy->isFloatingPointTy() && EltTy->isIEEE()) {
4060+
if (EltTy->isIEEELikeFPTy()) {
40614061
Value *FAbs = Builder.CreateUnaryIntrinsic(Intrinsic::fabs, CastOp);
40624062
Value *FNegFAbs = Builder.CreateFNeg(FAbs);
40634063
return new BitCastInst(FNegFAbs, I.getType());
@@ -4859,7 +4859,7 @@ Instruction *InstCombinerImpl::visitXor(BinaryOperator &I) {
48594859
!Builder.GetInsertBlock()->getParent()->hasFnAttribute(
48604860
Attribute::NoImplicitFloat)) {
48614861
Type *EltTy = CastOp->getType()->getScalarType();
4862-
if (EltTy->isFloatingPointTy() && EltTy->isIEEE()) {
4862+
if (EltTy->isIEEELikeFPTy()) {
48634863
Value *FNeg = Builder.CreateFNeg(CastOp);
48644864
return new BitCastInst(FNeg, I.getType());
48654865
}

llvm/unittests/SandboxIR/TypesTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ define void @foo(i32 %v0) {
180180
EXPECT_EQ(VecTy32x2->getScalarSizeInBits(), 32u);
181181
// Check getFPMantissaWidth().
182182
EXPECT_EQ(FloatTy->getFPMantissaWidth(), LLVMFloatTy->getFPMantissaWidth());
183-
// Check isIEEE().
184-
EXPECT_EQ(FloatTy->isIEEE(), LLVMFloatTy->isIEEE());
183+
// Check isIEEELikeFPTy().
184+
EXPECT_EQ(FloatTy->isIEEELikeFPTy(), LLVMFloatTy->isIEEELikeFPTy());
185185
// Check getScalarType().
186186
EXPECT_EQ(
187187
Ctx.getType(llvm::FixedVectorType::get(LLVMInt32Ty, 8u))->getScalarType(),

0 commit comments

Comments
 (0)