[llvm] [LLVM][IR] Add constant range support for floating-point types (PR #86483)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 21 23:22:06 PDT 2024
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/86483
>From 9928b1408e5cb949de0eb2ef705c62b85286a85c Mon Sep 17 00:00:00 2001
From: Yingwei Zheng <dtcxzyw2333 at gmail.com>
Date: Tue, 27 Feb 2024 01:47:23 +0800
Subject: [PATCH 1/3] tmp
---
llvm/include/llvm/IR/ConstantFPRange.h | 139 +++++++++++++++++++++++++
1 file changed, 139 insertions(+)
create mode 100644 llvm/include/llvm/IR/ConstantFPRange.h
diff --git a/llvm/include/llvm/IR/ConstantFPRange.h b/llvm/include/llvm/IR/ConstantFPRange.h
new file mode 100644
index 0000000000000..89b0cd0b7763b
--- /dev/null
+++ b/llvm/include/llvm/IR/ConstantFPRange.h
@@ -0,0 +1,139 @@
+//===- ConstantFPRange.h - Represent a range for floating-point -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Represent a range of possible values that may occur when the program is run
+// for a floating-point value. This keeps track of a lower and upper bound for
+// the constant.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_IR_CONSTANTFPRANGE_H
+#define LLVM_IR_CONSTANTFPRANGE_H
+
+#include "llvm/ADT/APFloat.h"
+#include "llvm/IR/InstrTypes.h"
+#include "llvm/IR/Instruction.h"
+#include "llvm/Support/Compiler.h"
+#include <optional>
+
+namespace llvm {
+
+class raw_ostream;
+struct KnownFPClass;
+
+/// This class represents a range of floating-point values.
+class [[nodiscard]] ConstantFPRange {
+ APFloat Lower, Upper;
+ bool MaybeQNaN : 1;
+ bool MaybeSNaN : 1;
+ bool SignBitMaybeZero : 1;
+ bool SignBitMaybeOne : 1;
+
+ /// Create empty constant range with same semantics.
+ ConstantFPRange getEmpty() const {
+ return ConstantFPRange(getSemantics(), /*IsFullSet=*/false);
+ }
+
+ /// Create full constant range with same semantics.
+ ConstantFPRange getFull() const {
+ return ConstantFPRange(getSemantics(), /*IsFullSet=*/true);
+ }
+
+public:
+ /// Initialize a full or empty set for the specified semantics.
+ explicit ConstantFPRange(const fltSemantics &FloatSema, bool IsFullSet);
+
+ /// Initialize a range to hold the single specified value.
+ ConstantFPRange(const APFloat &Value);
+
+ /// Initialize a range of values explicitly.
+ ConstantFPRange(APFloat Lower, APFloat Upper, bool MaybeQNaN, bool MaybeSNaN,
+ bool SignBitMaybeZero, bool SignBitMaybeOne);
+
+ /// Create empty constant range with the given semantics.
+ static ConstantFPRange getEmpty(const fltSemantics &FloatSema) {
+ return ConstantFPRange(FloatSema, /*IsFullSet=*/false);
+ }
+
+ /// Create full constant range with the given semantics.
+ static ConstantFPRange getFull(const fltSemantics &FloatSema) {
+ return ConstantFPRange(FloatSema, /*IsFullSet=*/true);
+ }
+
+ /// Initialize a range based on a known floating-point classes constraint.
+ static ConstantFPRange fromKnownFPClass(const KnownFPClass &Known);
+
+ /// Produce the exact range such that all values in the returned range satisfy
+ /// the given predicate with any value contained within Other. Formally, this
+ /// returns the exact answer when the superset of 'union over all y in Other
+ /// is exactly same as the subset of intersection over all y in Other.
+ /// { x : fcmp op x y is true}'.
+ ///
+ /// Example: Pred = olt and Other = float 3 returns [-inf, 3)
+ static ConstantFPRange makeExactFCmpRegion(FCmpInst::Predicate Pred,
+ const APFloat &Other);
+
+ /// Does the predicate \p Pred hold between ranges this and \p Other?
+ /// NOTE: false does not mean that inverse predicate holds!
+ bool fcmp(FCmpInst::Predicate Pred, const ConstantFPRange &Other) const;
+
+ /// Return the lower value for this range.
+ const APFloat &getLower() const { return Lower; }
+
+ /// Return the upper value for this range.
+ const APFloat &getUpper() const { return Upper; }
+
+ /// Get the semantics of this ConstantFPRange.
+ const fltSemantics &getSemantics() const { return Lower.getSemantics(); }
+
+ /// Return true if this set contains all of the elements possible
+ /// for this data-type.
+ bool isFullSet() const;
+
+ /// Return true if this set contains no members.
+ bool isEmptySet() const;
+
+ /// Return true if the specified value is in the set.
+ bool contains(const APFloat &Val) const;
+
+ /// Return true if the other range is a subset of this one.
+ bool contains(const ConstantFPRange &CR) const;
+
+ /// If this set contains a single element, return it, otherwise return null.
+ const APFloat *getSingleElement() const;
+
+ /// Return true if this set contains exactly one member.
+ bool isSingleElement() const { return getSingleElement() != nullptr; }
+
+ /// Return true if the sign bit of all values in this range is 1.
+ /// Return false if the sign bit of all values in this range is 0.
+ /// Otherwise, return std::nullopt.
+ std::optional<bool> getSignBit();
+
+ /// Return true if this range is equal to another range.
+ bool operator==(const ConstantFPRange &CR) const;
+ bool operator!=(const ConstantFPRange &CR) const { return !operator==(CR); }
+
+ /// Return known floating-point classes for values in this range.
+ KnownFPClass toKnownFPClass();
+
+ /// Print out the bounds to a stream.
+ void print(raw_ostream &OS) const;
+
+ /// Allow printing from a debugger easily.
+ void dump() const;
+};
+
+inline raw_ostream &operator<<(raw_ostream &OS, const ConstantFPRange &CR) {
+ CR.print(OS);
+ return OS;
+}
+
+} // end namespace llvm
+
+#endif // LLVM_IR_CONSTANTFPRANGE_H
>From 6491a81ec25f32819244021315dcc98af1407b78 Mon Sep 17 00:00:00 2001
From: Yingwei Zheng <dtcxzyw2333 at gmail.com>
Date: Fri, 21 Jun 2024 22:05:04 +0800
Subject: [PATCH 2/3] add basic implementation
---
llvm/include/llvm/IR/ConstantFPRange.h | 79 ++++++--
llvm/lib/IR/CMakeLists.txt | 1 +
llvm/lib/IR/ConstantFPRange.cpp | 253 +++++++++++++++++++++++++
3 files changed, 315 insertions(+), 18 deletions(-)
create mode 100644 llvm/lib/IR/ConstantFPRange.cpp
diff --git a/llvm/include/llvm/IR/ConstantFPRange.h b/llvm/include/llvm/IR/ConstantFPRange.h
index 89b0cd0b7763b..3cfc6f362f2b8 100644
--- a/llvm/include/llvm/IR/ConstantFPRange.h
+++ b/llvm/include/llvm/IR/ConstantFPRange.h
@@ -10,15 +10,18 @@
// for a floating-point value. This keeps track of a lower and upper bound for
// the constant.
//
+// Range = [Lower, Upper] U (MayBeQNaN ? QNaN : {}) U (MayBeSNaN ? SNaN : {})
+// Specifically, [inf, -inf] represents an empty set.
+// Note: -0 is considered to be less than 0. That is, range [0, 0] doesn't
+// contain -0.
+//
//===----------------------------------------------------------------------===//
#ifndef LLVM_IR_CONSTANTFPRANGE_H
#define LLVM_IR_CONSTANTFPRANGE_H
#include "llvm/ADT/APFloat.h"
-#include "llvm/IR/InstrTypes.h"
-#include "llvm/IR/Instruction.h"
-#include "llvm/Support/Compiler.h"
+#include "llvm/IR/Instructions.h"
#include <optional>
namespace llvm {
@@ -29,10 +32,8 @@ struct KnownFPClass;
/// This class represents a range of floating-point values.
class [[nodiscard]] ConstantFPRange {
APFloat Lower, Upper;
- bool MaybeQNaN : 1;
- bool MaybeSNaN : 1;
- bool SignBitMaybeZero : 1;
- bool SignBitMaybeOne : 1;
+ bool MayBeQNaN : 1;
+ bool MayBeSNaN : 1;
/// Create empty constant range with same semantics.
ConstantFPRange getEmpty() const {
@@ -44,29 +45,55 @@ class [[nodiscard]] ConstantFPRange {
return ConstantFPRange(getSemantics(), /*IsFullSet=*/true);
}
+ void makeEmpty();
+ void makeFull();
+ bool isNaNOnly() const;
+
public:
+ /// Return true if the floating point format is supported.
+ static bool isSupportedSemantics(const fltSemantics &Sem);
+
/// Initialize a full or empty set for the specified semantics.
- explicit ConstantFPRange(const fltSemantics &FloatSema, bool IsFullSet);
+ explicit ConstantFPRange(const fltSemantics &Sem, bool IsFullSet);
/// Initialize a range to hold the single specified value.
ConstantFPRange(const APFloat &Value);
/// Initialize a range of values explicitly.
- ConstantFPRange(APFloat Lower, APFloat Upper, bool MaybeQNaN, bool MaybeSNaN,
- bool SignBitMaybeZero, bool SignBitMaybeOne);
+ ConstantFPRange(APFloat LowerVal, APFloat UpperVal, bool MayBeQNaN = true,
+ bool MaybeSNaN = true);
/// Create empty constant range with the given semantics.
- static ConstantFPRange getEmpty(const fltSemantics &FloatSema) {
- return ConstantFPRange(FloatSema, /*IsFullSet=*/false);
+ static ConstantFPRange getEmpty(const fltSemantics &Sem) {
+ return ConstantFPRange(Sem, /*IsFullSet=*/false);
}
/// Create full constant range with the given semantics.
- static ConstantFPRange getFull(const fltSemantics &FloatSema) {
- return ConstantFPRange(FloatSema, /*IsFullSet=*/true);
+ static ConstantFPRange getFull(const fltSemantics &Sem) {
+ return ConstantFPRange(Sem, /*IsFullSet=*/true);
}
- /// Initialize a range based on a known floating-point classes constraint.
- static ConstantFPRange fromKnownFPClass(const KnownFPClass &Known);
+ /// Produce the smallest range such that all values that may satisfy the given
+ /// predicate with any value contained within Other is contained in the
+ /// returned range. Formally, this returns a superset of
+ /// 'union over all y in Other . { x : fcmp op x y is true }'. If the exact
+ /// answer is not representable as a ConstantRange, the return value will be a
+ /// proper superset of the above.
+ ///
+ /// Example: Pred = ole and Other = float [2, 5] returns Result = [-inf, 5]
+ static ConstantFPRange makeAllowedFCmpRegion(FCmpInst::Predicate Pred,
+ const ConstantFPRange &Other);
+
+ /// Produce the largest range such that all values in the returned range
+ /// satisfy the given predicate with all values contained within Other.
+ /// Formally, this returns a subset of
+ /// 'intersection over all y in Other . { x : fcmp op x y is true }'. If the
+ /// exact answer is not representable as a ConstantRange, the return value
+ /// will be a proper subset of the above.
+ ///
+ /// Example: Pred = ole and Other = float [2, 5] returns [-inf, 2]
+ static ConstantFPRange makeSatisfyingFCmpRegion(FCmpInst::Predicate Pred,
+ const ConstantFPRange &Other);
/// Produce the exact range such that all values in the returned range satisfy
/// the given predicate with any value contained within Other. Formally, this
@@ -113,20 +140,36 @@ class [[nodiscard]] ConstantFPRange {
/// Return true if the sign bit of all values in this range is 1.
/// Return false if the sign bit of all values in this range is 0.
/// Otherwise, return std::nullopt.
- std::optional<bool> getSignBit();
+ std::optional<bool> getSignBit() const;
/// Return true if this range is equal to another range.
bool operator==(const ConstantFPRange &CR) const;
+ /// Return true if this range is not equal to another range.
bool operator!=(const ConstantFPRange &CR) const { return !operator==(CR); }
+ /// 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();
+ KnownFPClass toKnownFPClass() const;
/// Print out the bounds to a stream.
void print(raw_ostream &OS) const;
/// Allow printing from a debugger easily.
void dump() const;
+
+ /// Return the range that results from the intersection of this range with
+ /// another range.
+ ConstantFPRange intersectWith(const ConstantFPRange &CR) const;
+
+ /// Return the range that results from the union of this range
+ /// with another range. The resultant range is guaranteed to include the
+ /// elements of both sets, but may contain more.
+ ConstantFPRange unionWith(const ConstantFPRange &CR) const;
+
+ /// Return a new range that is the logical not of the current set.
+ ConstantFPRange inverse() const;
};
inline raw_ostream &operator<<(raw_ostream &OS, const ConstantFPRange &CR) {
diff --git a/llvm/lib/IR/CMakeLists.txt b/llvm/lib/IR/CMakeLists.txt
index 20f169913087a..ca237156d8237 100644
--- a/llvm/lib/IR/CMakeLists.txt
+++ b/llvm/lib/IR/CMakeLists.txt
@@ -8,6 +8,7 @@ add_llvm_component_library(LLVMCore
BuiltinGCs.cpp
Comdat.cpp
ConstantFold.cpp
+ ConstantFPRange.cpp
ConstantRange.cpp
Constants.cpp
ConvergenceVerifier.cpp
diff --git a/llvm/lib/IR/ConstantFPRange.cpp b/llvm/lib/IR/ConstantFPRange.cpp
new file mode 100644
index 0000000000000..1576da4fc0b3e
--- /dev/null
+++ b/llvm/lib/IR/ConstantFPRange.cpp
@@ -0,0 +1,253 @@
+//===- ConstantFPRange.cpp - ConstantFPRange implementation ---------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Represent a range of possible values that may occur when the program is run
+// for a floating-point value. This keeps track of a lower and upper bound for
+// the constant.
+//
+// Range = [Lower, Upper] U (MayBeQNaN ? QNaN : {}) U (MayBeSNaN ? SNaN : {})
+// Specifically, [inf, -inf] represents an empty set.
+// Note: -0 is considered to be less than 0. That is, range [0, 0] doesn't
+// contain -0.
+//
+//===----------------------------------------------------------------------===//
+
+#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>
+
+using namespace llvm;
+
+// A floating point format must supports NaN, Inf and -0.
+bool ConstantFPRange::isSupportedSemantics(const fltSemantics &Sem) {
+ switch (APFloat::SemanticsToEnum(Sem)) {
+ default:
+ return false;
+ case APFloat::S_IEEEhalf:
+ case APFloat::S_BFloat:
+ case APFloat::S_IEEEsingle:
+ case APFloat::S_IEEEdouble:
+ case APFloat::S_IEEEquad:
+ return true;
+ }
+}
+
+void ConstantFPRange::makeEmpty() {
+ auto &Sem = Lower.getSemantics();
+ Lower = APFloat::getInf(Sem, /*Negative=*/false);
+ Upper = APFloat::getInf(Sem, /*Negative=*/true);
+ MayBeQNaN = false;
+ MayBeSNaN = false;
+}
+
+void ConstantFPRange::makeFull() {
+ auto &Sem = Lower.getSemantics();
+ Lower = APFloat::getInf(Sem, /*Negative=*/true);
+ Upper = APFloat::getInf(Sem, /*Negative=*/false);
+ MayBeQNaN = true;
+ MayBeSNaN = true;
+}
+
+bool ConstantFPRange::isNaNOnly() const {
+ return Lower.isPosInfinity() && Upper.isNegInfinity();
+}
+
+ConstantFPRange::ConstantFPRange(const fltSemantics &Sem, bool IsFullSet)
+ : Lower(Sem, APFloat::uninitialized), Upper(Sem, APFloat::uninitialized) {
+ assert(isSupportedSemantics(Sem) && "Unsupported fp format");
+ Lower = APFloat::getInf(Sem, /*Negative=*/IsFullSet);
+ Upper = APFloat::getInf(Sem, /*Negative=*/!IsFullSet);
+ MayBeQNaN = IsFullSet;
+ MayBeSNaN = IsFullSet;
+}
+
+ConstantFPRange::ConstantFPRange(const APFloat &Value)
+ : Lower(Value.getSemantics(), APFloat::uninitialized),
+ Upper(Value.getSemantics(), APFloat::uninitialized) {
+ assert(isSupportedSemantics(getSemantics()) && "Unsupported fp format");
+
+ if (Value.isNaN()) {
+ makeEmpty();
+ bool isSNaN = Value.isSignaling();
+ MayBeQNaN = !isSNaN;
+ MayBeSNaN = isSNaN;
+ } else {
+ Lower = Upper = Value;
+ MayBeQNaN = MayBeSNaN = false;
+ }
+}
+
+// We treat that -0 is less than 0 here.
+static APFloat::cmpResult strictCompare(const APFloat &LHS,
+ const APFloat &RHS) {
+ assert(!LHS.isNaN() && !RHS.isNaN() && "Unordered compare");
+ if (LHS.isZero() && RHS.isZero()) {
+ if (LHS.isNegative() == RHS.isNegative())
+ return APFloat::cmpEqual;
+ return LHS.isNegative() ? APFloat::cmpLessThan : APFloat::cmpGreaterThan;
+ }
+ return LHS.compare(RHS);
+}
+
+ConstantFPRange::ConstantFPRange(APFloat LowerVal, APFloat UpperVal,
+ bool MayBeQNaN, bool MaybeSNaN)
+ : Lower(std::move(LowerVal)), Upper(std::move(UpperVal)) {
+ assert(isSupportedSemantics(getSemantics()) && "Unsupported fp format");
+
+ // Canonicalize empty set into [Inf, -Inf].
+ if (strictCompare(Lower, Upper) == APFloat::cmpGreaterThan &&
+ !(Lower.isInfinity() && Upper.isInfinity()))
+ makeEmpty();
+ this->MayBeQNaN = MayBeQNaN;
+ this->MayBeSNaN = MayBeSNaN;
+}
+
+ConstantFPRange
+ConstantFPRange::makeAllowedFCmpRegion(FCmpInst::Predicate Pred,
+ const ConstantFPRange &Other) {
+ // TODO
+ return getFull(Other.getSemantics());
+}
+
+ConstantFPRange
+ConstantFPRange::makeSatisfyingFCmpRegion(FCmpInst::Predicate Pred,
+ const ConstantFPRange &Other) {
+ // TODO
+ return getEmpty(Other.getSemantics());
+}
+
+ConstantFPRange ConstantFPRange::makeExactFCmpRegion(FCmpInst::Predicate Pred,
+ const APFloat &Other) {
+ return makeAllowedFCmpRegion(Pred, Other);
+}
+
+bool ConstantFPRange::fcmp(FCmpInst::Predicate Pred,
+ const ConstantFPRange &Other) const {
+ return makeSatisfyingFCmpRegion(Pred, Other).contains(*this);
+}
+
+bool ConstantFPRange::isFullSet() const {
+ return Lower.isNegInfinity() && Upper.isPosInfinity() && MayBeQNaN &&
+ MayBeSNaN;
+}
+
+bool ConstantFPRange::isEmptySet() const {
+ return Lower.isPosInfinity() && Upper.isNegInfinity() && !MayBeQNaN &&
+ !MayBeSNaN;
+}
+
+bool ConstantFPRange::contains(const APFloat &Val) const {
+ assert(&getSemantics() == &Val.getSemantics() &&
+ "Should only use the same semantics");
+
+ if (Val.isNaN())
+ return Val.isSignaling() ? MayBeSNaN : MayBeQNaN;
+ return strictCompare(Lower, Val) != APFloat::cmpGreaterThan &&
+ strictCompare(Val, Upper) != APFloat::cmpGreaterThan;
+}
+
+bool ConstantFPRange::contains(const ConstantFPRange &CR) const {
+ assert(&getSemantics() == &CR.getSemantics() &&
+ "Should only use the same semantics");
+
+ if (CR.MayBeQNaN && !MayBeQNaN)
+ return false;
+
+ if (CR.MayBeSNaN && !MayBeSNaN)
+ return false;
+
+ return strictCompare(Lower, CR.Lower) != APFloat::cmpGreaterThan &&
+ strictCompare(CR.Upper, Upper) != APFloat::cmpGreaterThan;
+}
+
+const APFloat *ConstantFPRange::getSingleElement() const {
+ if (MayBeSNaN || MayBeQNaN)
+ return nullptr;
+ return Lower.bitwiseIsEqual(Upper) ? &Lower : nullptr;
+}
+
+std::optional<bool> ConstantFPRange::getSignBit() const {
+ if (!MayBeSNaN && !MayBeQNaN && Lower.isNegative() == Upper.isNegative())
+ return Lower.isNegative();
+ return std::nullopt;
+}
+
+bool ConstantFPRange::operator==(const ConstantFPRange &CR) const {
+ if (MayBeSNaN != CR.MayBeSNaN || MayBeQNaN != CR.MayBeQNaN)
+ return false;
+ return Lower.bitwiseIsEqual(CR.Lower) && Upper.bitwiseIsEqual(CR.Upper);
+}
+
+FPClassTest ConstantFPRange::classify() const {
+ uint32_t Mask = fcNone;
+ if (MayBeSNaN)
+ Mask |= fcSNan;
+ if (MayBeQNaN)
+ Mask |= fcQNan;
+ if (!isNaNOnly()) {
+ FPClassTest LowerMask = Lower.classify();
+ FPClassTest UpperMask = Upper.classify();
+ assert(LowerMask <= UpperMask && "Range is nan-only.");
+ for (uint32_t I = LowerMask; I <= UpperMask; I <<= 1)
+ Mask |= I;
+ }
+ 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";
+ else if (isEmptySet())
+ OS << "empty-set";
+ else {
+ bool NaNOnly = isNaNOnly();
+ if (!NaNOnly) {
+ OS << '[';
+ Lower.print(OS);
+ OS << ", ";
+ Upper.print(OS);
+ OS << ']';
+ }
+
+ if (MayBeSNaN || MayBeQNaN) {
+ if (!NaNOnly)
+ OS << " with ";
+ if (MayBeSNaN && MayBeQNaN)
+ OS << "NaN";
+ else if (MayBeSNaN)
+ OS << "SNaN";
+ else if (MayBeQNaN)
+ OS << "QNaN";
+ }
+ }
+}
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+LLVM_DUMP_METHOD void ConstantFPRange::dump() const { print(dbgs()); }
+#endif
+
+ConstantFPRange
+ConstantFPRange::intersectWith(const ConstantFPRange &CR) const {
+ return ConstantFPRange(maxnum(Lower, CR.Lower), minnum(Upper, CR.Upper),
+ MayBeQNaN & CR.MayBeQNaN, MayBeSNaN & CR.MayBeSNaN);
+}
+
+ConstantFPRange ConstantFPRange::unionWith(const ConstantFPRange &CR) const {
+ return ConstantFPRange(minnum(Lower, CR.Lower), maxnum(Upper, CR.Upper),
+ MayBeQNaN | CR.MayBeQNaN, MayBeSNaN | CR.MayBeSNaN);
+}
>From 661dc2876f018c06e626b03368bdf2cf0bd19bce Mon Sep 17 00:00:00 2001
From: Yingwei Zheng <dtcxzyw2333 at gmail.com>
Date: Sat, 22 Jun 2024 14:21:31 +0800
Subject: [PATCH 3/3] [LLVM][IR] Remove comments. NFC.
---
llvm/lib/IR/ConstantFPRange.cpp | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/llvm/lib/IR/ConstantFPRange.cpp b/llvm/lib/IR/ConstantFPRange.cpp
index 1576da4fc0b3e..10462968fbea9 100644
--- a/llvm/lib/IR/ConstantFPRange.cpp
+++ b/llvm/lib/IR/ConstantFPRange.cpp
@@ -5,17 +5,6 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
-//
-// Represent a range of possible values that may occur when the program is run
-// for a floating-point value. This keeps track of a lower and upper bound for
-// the constant.
-//
-// Range = [Lower, Upper] U (MayBeQNaN ? QNaN : {}) U (MayBeSNaN ? SNaN : {})
-// Specifically, [inf, -inf] represents an empty set.
-// Note: -0 is considered to be less than 0. That is, range [0, 0] doesn't
-// contain -0.
-//
-//===----------------------------------------------------------------------===//
#include "llvm/IR/ConstantFPRange.h"
#include "llvm/ADT/APFloat.h"
More information about the llvm-commits
mailing list