Skip to content

Commit 23f064f

Browse files
committed
[ConstantFPRange] Address review comments. NFC.
1 parent 6e3ad10 commit 23f064f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

llvm/lib/IR/ConstantFPRange.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ ConstantFPRange ConstantFPRange::getNonNaN(const fltSemantics &Sem) {
111111
/// Return [-inf, V) or [-inf, V]
112112
static ConstantFPRange makeLessThan(APFloat V, FCmpInst::Predicate Pred) {
113113
const fltSemantics &Sem = V.getSemantics();
114-
if (!(Pred & FCmpInst::FCMP_OEQ)) {
114+
if (FCmpInst::isFalseWhenEqual(FCmpInst::getOrderedPredicate(Pred))) {
115115
if (V.isNegInfinity())
116116
return ConstantFPRange::getEmpty(Sem);
117117
V.next(/*nextDown=*/true);
@@ -123,7 +123,7 @@ static ConstantFPRange makeLessThan(APFloat V, FCmpInst::Predicate Pred) {
123123
/// Return (V, +inf] or [V, +inf]
124124
static ConstantFPRange makeGreaterThan(APFloat V, FCmpInst::Predicate Pred) {
125125
const fltSemantics &Sem = V.getSemantics();
126-
if (!(Pred & FCmpInst::FCMP_OEQ)) {
126+
if (FCmpInst::isFalseWhenEqual(FCmpInst::getOrderedPredicate(Pred))) {
127127
if (V.isPosInfinity())
128128
return ConstantFPRange::getEmpty(Sem);
129129
V.next(/*nextDown=*/false);
@@ -135,7 +135,7 @@ static ConstantFPRange makeGreaterThan(APFloat V, FCmpInst::Predicate Pred) {
135135
/// Make sure that +0/-0 are both included in the range.
136136
static ConstantFPRange extendZeroIfEqual(const ConstantFPRange &CR,
137137
FCmpInst::Predicate Pred) {
138-
if (!(Pred & FCmpInst::FCMP_OEQ))
138+
if (FCmpInst::isFalseWhenEqual(FCmpInst::getOrderedPredicate(Pred)))
139139
return CR;
140140

141141
APFloat Lower = CR.getLower();

llvm/unittests/IR/ConstantFPRangeTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ TEST_F(ConstantFPRangeTest, makeAllowedFCmpRegion) {
459459
Optimal = Optimal.unionWith(ConstantFPRange(V));
460460
});
461461

462-
ASSERT_TRUE(Res.contains(Optimal))
462+
EXPECT_TRUE(Res.contains(Optimal))
463463
<< "Wrong result for makeAllowedFCmpRegion(" << Pred << ", " << CR
464464
<< "). Expected " << Optimal << ", but got " << Res;
465465
EXPECT_EQ(Res, Optimal)

0 commit comments

Comments
 (0)