Skip to content

[LLVM][IR] Add constant range support for floating-point types #86483

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 10 commits into from
Sep 25, 2024

Conversation

dtcxzyw
Copy link
Member

@dtcxzyw dtcxzyw commented Mar 25, 2024

Related issues: #68301 #70985 #82381

Copy link

✅ With the latest revision this PR passed the Python code formatter.

Copy link

✅ With the latest revision this PR passed the C/C++ code formatter.

@tschuett tschuett requested a review from arsenm March 25, 2024 12:28
@dtcxzyw
Copy link
Member Author

dtcxzyw commented Mar 25, 2024

@tschuett This patch is not ready for review.

@dtcxzyw dtcxzyw removed the request for review from arsenm March 25, 2024 14:53
@tschuett
Copy link

Sorry. The GlobalIsel combiner already uses ConstantRange. I would like to use ConstantFPRange as well.

@tschuett
Copy link

ConstantRange CR1 = ConstantRange::makeExactICmpRegion(

@arsenm arsenm added floating-point Floating-point math llvm:ir labels Mar 26, 2024
@llvmbot
Copy link
Member

llvmbot commented Mar 26, 2024

@llvm/pr-subscribers-llvm-support
@llvm/pr-subscribers-llvm-adt

@llvm/pr-subscribers-llvm-ir

Author: Yingwei Zheng (dtcxzyw)

Changes

Related issues: #68301 #70985 #82381


Full diff: https://github.com/llvm/llvm-project/pull/86483.diff

1 Files Affected:

  • (added) llvm/include/llvm/IR/ConstantFPRange.h (+139)
diff --git a/llvm/include/llvm/IR/ConstantFPRange.h b/llvm/include/llvm/IR/ConstantFPRange.h
new file mode 100644
index 00000000000000..89b0cd0b7763b5
--- /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

Comment on lines 34 to 35
bool SignBitMaybeZero : 1;
bool SignBitMaybeOne : 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't understand why these would be "MaybeZero" or "MaybeOne". Must be? Maybe would need to default to 1

Copy link
Contributor

@jcranmer-intel jcranmer-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely clear to me from the UI whether or not the range is half-open or closed, which tends to matter more for floating-point values than it does for integers.

If it's half-open, then how is one supposed to represent [inf, inf]?

@dtcxzyw dtcxzyw force-pushed the constant-fp-range branch from 496d617 to 9928b14 Compare June 20, 2024 05:47
@dtcxzyw
Copy link
Member Author

dtcxzyw commented Jun 21, 2024

Not entirely clear to me from the UI whether or not the range is half-open or closed, which tends to matter more for floating-point values than it does for integers.

If it's half-open, then how is one supposed to represent [inf, inf]?

Currently we use closed intervals and use [inf,-inf] as the canonical form of an empty set.
BTW, do we need wrapped sets to represent something like {X: X < -10 || X > 10}? If not, there is no way to implement inverse.

Copy link
Contributor

@arsenm arsenm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@dtcxzyw
Copy link
Member Author

dtcxzyw commented Jun 25, 2024

BTW, do we need wrapped sets to represent something like {X: X < -10 || X > 10}? If not, there is no way to implement inverse.

Any thoughts? IMO there will be a significant maintenance burden for us if we plan to support wrapped sets.

@arsenm
Copy link
Contributor

arsenm commented Jun 25, 2024

BTW, do we need wrapped sets to represent something like {X: X < -10 || X > 10}? If not, there is no way to implement inverse.

Any thoughts? IMO there will be a significant maintenance burden for us if we plan to support wrapped sets.

I think it's potentially useful. Some instructions only operate in a range of values. Maybe doesn't need to be in the initial support

@nikic
Copy link
Contributor

nikic commented Jul 21, 2024

BTW, do we need wrapped sets to represent something like {X: X < -10 || X > 10}? If not, there is no way to implement inverse.

Any thoughts? IMO there will be a significant maintenance burden for us if we plan to support wrapped sets.

For integers, wrapped ranges are quite important because a non-wrapping signed range is often a wrapping unsigned range and vice versa. For FP, this problem does not exist as the ranges are always signed. I think it's better to leave out wrapped sets, at least for now, as they do make reasoning about operations a good bit harder.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have exhaustive testing infrastructure. On half, or one of the 8-bit types, if any of them is sufficiently IEEE compliant...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Float8E4M3 covers everything

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isSupportedSemantics has been removed. I will add fcmp support with exhaustive testing infrastructure in follow-up patches.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also have exhaustive tests for classify at least (the correctness of the implementation is not obvious to me) and possibly also intersect/union.

@dtcxzyw dtcxzyw marked this pull request as ready for review September 15, 2024 15:33

TEST_F(ConstantFPRangeTest, Enumerate) {
constexpr unsigned NNaNValues = (1 << 8) - 2 * ((1 << 3) - 1);
constexpr unsigned Expected = 4 * ((NNaNValues + 1) * NNaNValues / 2 + 1);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have 117616 ranges here. It is impossible to exhaustively test binary operations.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm yeah, I didn't think the numbers here through. Probably the best we can do instead is to have a list of interesting values (-inf, -largest_normal, -smallest_normal, -largest_subnormal, -smallest_subnormal, -0, +0, ...) plus a few normal numbers to use as boundary values. Not as good as full exhaustive coverage, but at least it makes sure that all the special cases are treated correctly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should test with a bit in every mantissa position

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reduced to 2664 ranges.


TEST_F(ConstantFPRangeTest, Enumerate) {
constexpr unsigned NNaNValues = (1 << 8) - 2 * ((1 << 3) - 1);
constexpr unsigned Expected = 4 * ((NNaNValues + 1) * NNaNValues / 2 + 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm yeah, I didn't think the numbers here through. Probably the best we can do instead is to have a list of interesting values (-inf, -largest_normal, -smallest_normal, -largest_subnormal, -smallest_subnormal, -0, +0, ...) plus a few normal numbers to use as boundary values. Not as good as full exhaustive coverage, but at least it makes sure that all the special cases are treated correctly.

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dtcxzyw
Copy link
Member Author

dtcxzyw commented Sep 25, 2024

@arsenm Is it ok to land this patch?

@dtcxzyw dtcxzyw merged commit fa824dc into llvm:main Sep 25, 2024
8 checks passed
@dtcxzyw dtcxzyw deleted the constant-fp-range branch September 25, 2024 05:58
@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 25, 2024

LLVM Buildbot has detected a new failure on builder ppc64le-lld-multistage-test running on ppc64le-lld-multistage-test while building llvm at step 12 "build-stage2-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/168/builds/3735

Here is the relevant piece of the build log for the reference
Step 12 (build-stage2-unified-tree) failure: build (failure)
...
16.236 [1/8/15] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangOptionDocEmitter.cpp.o
22.006 [1/7/16] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/SveEmitter.cpp.o
22.716 [1/6/17] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangOpenCLBuiltinEmitter.cpp.o
41.246 [1/5/18] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/RISCVVEmitter.cpp.o
42.828 [1/4/19] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/MveEmitter.cpp.o
45.077 [1/3/20] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangDiagnosticsEmitter.cpp.o
49.346 [1/2/21] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/NeonEmitter.cpp.o
73.686 [1/1/22] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangAttrEmitter.cpp.o
73.743 [0/1/23] Linking CXX executable bin/clang-tblgen
148.806 [3842/482/1939] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/ConstantFPRangeTest.cpp.o
FAILED: unittests/IR/CMakeFiles/IRTests.dir/ConstantFPRangeTest.cpp.o 
ccache /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/install/stage1/bin/clang++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage2/unittests/IR -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/IR -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage2/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googletest/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googlemock/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT unittests/IR/CMakeFiles/IRTests.dir/ConstantFPRangeTest.cpp.o -MF unittests/IR/CMakeFiles/IRTests.dir/ConstantFPRangeTest.cpp.o.d -o unittests/IR/CMakeFiles/IRTests.dir/ConstantFPRangeTest.cpp.o -c /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/IR/ConstantFPRangeTest.cpp
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/IR/ConstantFPRangeTest.cpp:417:16: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]
  417 |   EXPECT_DEATH(ConstantFPRange::getNonNaN(APFloat(1.0), APFloat(0.0)),
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googletest/include/gtest/gtest-death-test.h:190:15: note: expanded from macro 'EXPECT_DEATH'
  190 |   EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, matcher)
      |               ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googletest/include/gtest/gtest-death-test.h:179:21: note: expanded from macro 'EXPECT_EXIT'
  179 |   GTEST_DEATH_TEST_(statement, predicate, matcher, GTEST_NONFATAL_FAILURE_)
      |                     ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h:243:47: note: expanded from macro 'GTEST_DEATH_TEST_'
  243 |           GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt);            \
      |                                               ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h:216:50: note: expanded from macro 'GTEST_EXECUTE_DEATH_TEST_STATEMENT_'
  216 |   GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
      |                                                  ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-internal.h:1354:5: note: expanded from macro 'GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_'
 1354 |     statement;                                                    \
      |     ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/IR/ConstantFPRangeTest.cpp:421:16: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]
  421 |   EXPECT_DEATH(ConstantFPRange::getNonNaN(APFloat(0.0), APFloat(1.0f)),
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googletest/include/gtest/gtest-death-test.h:190:15: note: expanded from macro 'EXPECT_DEATH'
  190 |   EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, matcher)
      |               ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googletest/include/gtest/gtest-death-test.h:179:21: note: expanded from macro 'EXPECT_EXIT'
  179 |   GTEST_DEATH_TEST_(statement, predicate, matcher, GTEST_NONFATAL_FAILURE_)
      |                     ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h:243:47: note: expanded from macro 'GTEST_DEATH_TEST_'
  243 |           GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt);            \
      |                                               ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h:216:50: note: expanded from macro 'GTEST_EXECUTE_DEATH_TEST_STATEMENT_'
  216 |   GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
      |                                                  ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-internal.h:1354:5: note: expanded from macro 'GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_'
 1354 |     statement;                                                    \
      |     ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/IR/ConstantFPRangeTest.cpp:427:16: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]

@dtcxzyw
Copy link
Member Author

dtcxzyw commented Sep 25, 2024

error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]

@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 25, 2024

LLVM Buildbot has detected a new failure on builder clang-ppc64le-rhel running on ppc64le-clang-rhel-test while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/145/builds/2073

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
...
249.513 [356/48/769] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/UseTest.cpp.o
249.538 [355/48/770] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/UserTest.cpp.o
249.562 [354/48/771] Building CXX object unittests/Analysis/CMakeFiles/AnalysisTests.dir/ValueTrackingTest.cpp.o
249.773 [353/48/772] Linking CXX executable unittests/Analysis/AnalysisTests
250.032 [352/48/773] Building CXX object unittests/ExecutionEngine/MCJIT/CMakeFiles/MCJITTests.dir/MCJITObjectCacheTest.cpp.o
250.116 [351/48/774] Building CXX object tools/clang/unittests/Tooling/CMakeFiles/ToolingTests.dir/RefactoringTest.cpp.o
250.196 [350/48/775] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/VectorTypesTest.cpp.o
250.244 [349/48/776] Building CXX object unittests/ExecutionEngine/Orc/CMakeFiles/OrcJITTests.dir/JITTargetMachineBuilderTest.cpp.o
250.349 [348/48/777] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/VFABIDemanglerTest.cpp.o
250.487 [347/48/778] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/ConstantFPRangeTest.cpp.o
FAILED: unittests/IR/CMakeFiles/IRTests.dir/ConstantFPRangeTest.cpp.o 
ccache /home/docker/llvm-external-buildbots/clang.17.0.6/bin/clang++ --gcc-toolchain=/gcc-toolchain/usr -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/unittests/IR -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/unittests/IR -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/third-party/unittest/googletest/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/third-party/unittest/googlemock/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT unittests/IR/CMakeFiles/IRTests.dir/ConstantFPRangeTest.cpp.o -MF unittests/IR/CMakeFiles/IRTests.dir/ConstantFPRangeTest.cpp.o.d -o unittests/IR/CMakeFiles/IRTests.dir/ConstantFPRangeTest.cpp.o -c /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/unittests/IR/ConstantFPRangeTest.cpp
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/unittests/IR/ConstantFPRangeTest.cpp:417:16: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]
  417 |   EXPECT_DEATH(ConstantFPRange::getNonNaN(APFloat(1.0), APFloat(0.0)),
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/third-party/unittest/googletest/include/gtest/gtest-death-test.h:190:15: note: expanded from macro 'EXPECT_DEATH'
  190 |   EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, matcher)
      |               ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/third-party/unittest/googletest/include/gtest/gtest-death-test.h:179:21: note: expanded from macro 'EXPECT_EXIT'
  179 |   GTEST_DEATH_TEST_(statement, predicate, matcher, GTEST_NONFATAL_FAILURE_)
      |                     ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h:243:47: note: expanded from macro 'GTEST_DEATH_TEST_'
  243 |           GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt);            \
      |                                               ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h:216:50: note: expanded from macro 'GTEST_EXECUTE_DEATH_TEST_STATEMENT_'
  216 |   GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
      |                                                  ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-internal.h:1354:5: note: expanded from macro 'GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_'
 1354 |     statement;                                                    \
      |     ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/unittests/IR/ConstantFPRangeTest.cpp:421:16: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]
  421 |   EXPECT_DEATH(ConstantFPRange::getNonNaN(APFloat(0.0), APFloat(1.0f)),
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/third-party/unittest/googletest/include/gtest/gtest-death-test.h:190:15: note: expanded from macro 'EXPECT_DEATH'
  190 |   EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, matcher)
      |               ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/third-party/unittest/googletest/include/gtest/gtest-death-test.h:179:21: note: expanded from macro 'EXPECT_EXIT'
  179 |   GTEST_DEATH_TEST_(statement, predicate, matcher, GTEST_NONFATAL_FAILURE_)
      |                     ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h:243:47: note: expanded from macro 'GTEST_DEATH_TEST_'
  243 |           GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt);            \
      |                                               ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h:216:50: note: expanded from macro 'GTEST_EXECUTE_DEATH_TEST_STATEMENT_'
  216 |   GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
      |                                                  ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-internal.h:1354:5: note: expanded from macro 'GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_'
 1354 |     statement;                                                    \
      |     ^~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/unittests/IR/ConstantFPRangeTest.cpp:427:16: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]

@dtcxzyw
Copy link
Member Author

dtcxzyw commented Sep 25, 2024

error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]

Fixed by #109921.

Copy link
Contributor

@chapuni chapuni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has introduced a layering violation.

Pruning the problematic method may be a quick fix. Or please revert atm.

Comment on lines +199 to +204
KnownFPClass ConstantFPRange::toKnownFPClass() const {
KnownFPClass Result;
Result.KnownFPClasses = classify();
Result.SignBit = getSignBit();
return Result;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this to elsewhere?


#include "llvm/IR/ConstantFPRange.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/Analysis/ValueTracking.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LLVMCore should not depend on llvm/Analysis.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will post a fix later.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 25, 2024

LLVM Buildbot has detected a new failure on builder lld-x86_64-win running on as-worker-93 while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/146/builds/1233

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests.exe/35/87' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe-LLVM-Unit-2020-35-87.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=87 GTEST_SHARD_INDEX=35 C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe
--

Script:
--
C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe --gtest_filter=ProgramEnvTest.CreateProcessLongPath
--
C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(160): error: Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(163): error: fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied



C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:160
Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:163
fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied




********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 28, 2024

LLVM Buildbot has detected a new failure on builder clang-ppc64-aix running on aix-ppc64 while building llvm at step 3 "clean-build-dir".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/64/builds/1086

Here is the relevant piece of the build log for the reference
Step 3 (clean-build-dir) failure: Delete failed. (failure) (timed out)
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
...
1042.173 [425/50/535] Building CXX object unittests/DebugInfo/LogicalView/CMakeFiles/DebugInfoLogicalViewTests.dir/LogicalElementsTest.cpp.o
1042.308 [424/50/536] Linking CXX executable tools/clang/unittests/Sema/SemaTests
1042.560 [423/50/537] Building CXX object unittests/DebugInfo/LogicalView/CMakeFiles/DebugInfoLogicalViewTests.dir/DWARFReaderTest.cpp.o
1044.035 [422/50/538] Building CXX object unittests/ExecutionEngine/JITLink/CMakeFiles/JITLinkTests.dir/EHFrameSupportTests.cpp.o
1044.236 [421/50/539] Building CXX object unittests/DebugInfo/LogicalView/CMakeFiles/DebugInfoLogicalViewTests.dir/SelectElementsTest.cpp.o
1044.404 [420/50/540] Building CXX object unittests/DebugInfo/LogicalView/CMakeFiles/DebugInfoLogicalViewTests.dir/WarningInternalTest.cpp.o
1045.807 [419/50/541] Building CXX object unittests/ExecutionEngine/JITLink/CMakeFiles/JITLinkTests.dir/AArch32Tests.cpp.o
1045.992 [418/50/542] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/AbstractCallSiteTest.cpp.o
1046.383 [417/50/543] Building CXX object unittests/ExecutionEngine/MCJIT/CMakeFiles/MCJITTests.dir/MCJITTest.cpp.o
1046.573 [416/50/544] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/ConstantFPRangeTest.cpp.o
FAILED: unittests/IR/CMakeFiles/IRTests.dir/ConstantFPRangeTest.cpp.o 
/usr/local/clang-17.0.2/bin/clang++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LARGE_FILE_API -D_XOPEN_SOURCE=700 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/unittests/IR -I/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/unittests/IR -I/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/include -I/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/include -I/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/third-party/unittest/googletest/include -I/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/third-party/unittest/googlemock/include -mcmodel=large -fPIC -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT unittests/IR/CMakeFiles/IRTests.dir/ConstantFPRangeTest.cpp.o -MF unittests/IR/CMakeFiles/IRTests.dir/ConstantFPRangeTest.cpp.o.d -o unittests/IR/CMakeFiles/IRTests.dir/ConstantFPRangeTest.cpp.o -c /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/unittests/IR/ConstantFPRangeTest.cpp
/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/unittests/IR/ConstantFPRangeTest.cpp:417:16: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]
  417 |   EXPECT_DEATH(ConstantFPRange::getNonNaN(APFloat(1.0), APFloat(0.0)),
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/third-party/unittest/googletest/include/gtest/gtest-death-test.h:190:15: note: expanded from macro 'EXPECT_DEATH'
  190 |   EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, matcher)
      |               ^~~~~~~~~
/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/third-party/unittest/googletest/include/gtest/gtest-death-test.h:179:21: note: expanded from macro 'EXPECT_EXIT'
  179 |   GTEST_DEATH_TEST_(statement, predicate, matcher, GTEST_NONFATAL_FAILURE_)
      |                     ^~~~~~~~~
/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h:243:47: note: expanded from macro 'GTEST_DEATH_TEST_'
  243 |           GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt);            \
      |                                               ^~~~~~~~~
/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h:216:50: note: expanded from macro 'GTEST_EXECUTE_DEATH_TEST_STATEMENT_'
  216 |   GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
      |                                                  ^~~~~~~~~
/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-internal.h:1354:5: note: expanded from macro 'GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_'
 1354 |     statement;                                                    \
      |     ^~~~~~~~~
/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/unittests/IR/ConstantFPRangeTest.cpp:421:16: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]
  421 |   EXPECT_DEATH(ConstantFPRange::getNonNaN(APFloat(0.0), APFloat(1.0f)),
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/third-party/unittest/googletest/include/gtest/gtest-death-test.h:190:15: note: expanded from macro 'EXPECT_DEATH'
  190 |   EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, matcher)
      |               ^~~~~~~~~
/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/third-party/unittest/googletest/include/gtest/gtest-death-test.h:179:21: note: expanded from macro 'EXPECT_EXIT'
  179 |   GTEST_DEATH_TEST_(statement, predicate, matcher, GTEST_NONFATAL_FAILURE_)
      |                     ^~~~~~~~~
/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h:243:47: note: expanded from macro 'GTEST_DEATH_TEST_'
  243 |           GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt);            \
      |                                               ^~~~~~~~~
/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h:216:50: note: expanded from macro 'GTEST_EXECUTE_DEATH_TEST_STATEMENT_'
  216 |   GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
      |                                                  ^~~~~~~~~
/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-internal.h:1354:5: note: expanded from macro 'GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_'
 1354 |     statement;                                                    \
      |     ^~~~~~~~~
/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/unittests/IR/ConstantFPRangeTest.cpp:427:16: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]

Comment on lines +121 to +123
/// 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}'.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Formally" part doesn't seem to make sense - did something go wrong with the single-quoted part? Isn't it just: Formally, this returns { x : fcmp op x Other is true}?

/// 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit vague. Maybe "Return the smallest FPClassTest which includes all values in the range"?

/// another range.
ConstantFPRange intersectWith(const ConstantFPRange &CR) const;

/// Return the range that results from the union of this range
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "Return the smallest range ...", just to be clear?

/// 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "a single non-NaN element" would be clearer, here and in isSingleElement below?

Comment on lines +90 to +91
this->MayBeQNaN = MayBeQNaN;
this->MayBeSNaN = MayBeSNaN;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you not initialize these in the member initializer list?

Comment on lines +193 to +195
for (uint32_t I = LowerMask; I <= UpperMask; I <<= 1)
Mask |= I;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do this without a loop: Mask |= (UpperMask << 1) - LowerMask (with a comment)

dtcxzyw added a commit that referenced this pull request Oct 2, 2024
1. Address post-commit review comments
#86483 (comment).
2. Move some NFC changes from
#110082 to this patch.
puja2196 pushed a commit to puja2196/LLVM-tutorial that referenced this pull request Oct 2, 2024
1. Address post-commit review comments
llvm/llvm-project#86483 (comment).
2. Move some NFC changes from
llvm/llvm-project#110082 to this patch.
Sterling-Augustine pushed a commit to Sterling-Augustine/llvm-project that referenced this pull request Oct 3, 2024
1. Address post-commit review comments
llvm#86483 (comment).
2. Move some NFC changes from
llvm#110082 to this patch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants