[all-commits] [llvm/llvm-project] 86858d: [ValueTracking] Propagate non-negativity through f...

Aayush Shrivastava via All-commits all-commits at lists.llvm.org
Sun Sep 13 11:47:29 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 86858de86cb28299ebc9c0ce8a06e5a61ed6b261
      https://github.com/llvm/llvm-project/commit/86858de86cb28299ebc9c0ce8a06e5a61ed6b261
  Author: Aayush Shrivastava <iamaayushrivastava at gmail.com>
  Date:   2026-09-13 (Sun, 13 Sep 2026)

  Changed paths:
    M clang/test/Headers/__clang_hip_math.hip
    M llvm/lib/Analysis/ValueTracking.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
    M llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-pow.ll
    M llvm/test/Transforms/InstCombine/fabs.ll
    M llvm/test/Transforms/InstCombine/sitofp.ll
    M llvm/unittests/Analysis/ValueTrackingTest.cpp

  Log Message:
  -----------
  [ValueTracking] Propagate non-negativity through fptosi (#217868)

Fixes #217442

`fptosi` is poison when the rounded value does not fit in the result
type, so `computeKnownBits` can assume the conversion rounds towards
zero without wrapping. Negative subnormals and negative zero always
round to 0, so only sources known to never be a negative normal or
negative infinity (i.e. values <= -1.0) can produce a negative result.

This lets InstCombine fold `(int)fabs(x) < 0` to `false`, matching GCC,
and also benefits other magnitude-clamping intrinsics such as sqrt.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list