[llvm-branch-commits] [llvm] ValueTracking: x - floor(x) cannot introduce overflow (PR #189003)

Jay Foad via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Mar 27 07:43:27 PDT 2026


================
@@ -4977,7 +4977,15 @@ static constexpr KnownFPClass::MinMaxKind getMinMaxKind(Intrinsic::ID IID) {
 /// \return true if this is a floating point value that is known to have a
 /// magnitude smaller than 1. i.e., fabs(X) <= 1.0
 static bool isAbsoluteValueLessEqualOne(const Value *V) {
-  // TODO: Handle frexp and x - floor(x)?
+  // TODO: Handle frexp
+  // TODO: Other rounding intrinsics?
+
+  // fabs(x - floor(x)) <= 1
----------------
jayfoad wrote:

This isn't true if x is inf or nan.

https://github.com/llvm/llvm-project/pull/189003


More information about the llvm-branch-commits mailing list