[all-commits] [llvm/llvm-project] 562a9c: DAG: Fold copysign with a known signmask to a disj...

Matt Arsenault via All-commits all-commits at lists.llvm.org
Sun Nov 9 21:18:07 PST 2025


  Branch: refs/heads/users/arsenm/dag-fold-copysign-known-bits-to-or
  Home:   https://github.com/llvm/llvm-project
  Commit: 562a9c31a5dc58a5381ed695a49b90139a9f3f77
      https://github.com/llvm/llvm-project/commit/562a9c31a5dc58a5381ed695a49b90139a9f3f77
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-11-09 (Sun, 09 Nov 2025)

  Changed paths:
    M llvm/include/llvm/CodeGen/SelectionDAG.h
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/test/CodeGen/AMDGPU/copysign-simplify-demanded-bits.ll
    M llvm/test/CodeGen/AMDGPU/copysign-to-disjoint-or-combine.ll

  Log Message:
  -----------
  DAG: Fold copysign with a known signmask to a disjoint or

If the sign bit is a computed sign mask (i.e., we know it's
either +0 or -0), turn this into a disjoint or. This pattern
appears in the pow implementations.

We also need to know the sign bit of the magnitude is 0 for
the or to be disjoint. Unfortunately the DAG's FP tracking is
weak and we did not have a way to check if the sign bit is known
0, so add something for that. Ideally we would get a complete
computeKnownFPClass implementation.

This is intended to help avoid the regression which caused
d3e7c4ce7a3d7 to be reverted.


  Commit: 09dbab6dce89cba7a2ced625921af27abfa59d68
      https://github.com/llvm/llvm-project/commit/09dbab6dce89cba7a2ced625921af27abfa59d68
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-11-09 (Sun, 09 Nov 2025)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

  Log Message:
  -----------
  Match shift to signbit pattern instead of computeKnownBits


  Commit: 2d6fb0fa22548791d04ecc0dd619395cc464063c
      https://github.com/llvm/llvm-project/commit/2d6fb0fa22548791d04ecc0dd619395cc464063c
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-11-09 (Sun, 09 Nov 2025)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

  Log Message:
  -----------
  Revert "Match shift to signbit pattern instead of computeKnownBits"

This reverts commit 49e2c3aa7a861fc8864c2d045b3804e31e1f13cc.

One case is slighly more sophisticated


Compare: https://github.com/llvm/llvm-project/compare/562a9c31a5dc%5E...2d6fb0fa2254

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