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

Matt Arsenault via All-commits all-commits at lists.llvm.org
Mon Nov 10 08:11:20 PST 2025


  Branch: refs/heads/users/arsenm/dag-fold-copysign-known-bits-to-or
  Home:   https://github.com/llvm/llvm-project
  Commit: d6b054dc67ba829009cb588faa5c868ea13121b9
      https://github.com/llvm/llvm-project/commit/d6b054dc67ba829009cb588faa5c868ea13121b9
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-11-10 (Mon, 10 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: 36287b03c05043a5de5949537fc1b9f7272692f7
      https://github.com/llvm/llvm-project/commit/36287b03c05043a5de5949537fc1b9f7272692f7
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-11-10 (Mon, 10 Nov 2025)

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

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


  Commit: ed01dc96d2a177cbb77db44c6895071141c79535
      https://github.com/llvm/llvm-project/commit/ed01dc96d2a177cbb77db44c6895071141c79535
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-11-10 (Mon, 10 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/2d6fb0fa2254...ed01dc96d2a1

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