[all-commits] [llvm/llvm-project] 4d7201: DAG: Stop trying to fold FP -(x-y) -> y-x in getNo...

Matt Arsenault via All-commits all-commits at lists.llvm.org
Tue Dec 31 20:15:24 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4d7201e7b988b62a6ca30416fd03847b5a39dae0
      https://github.com/llvm/llvm-project/commit/4d7201e7b988b62a6ca30416fd03847b5a39dae0
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2019-12-31 (Tue, 31 Dec 2019)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/test/CodeGen/AArch64/arm64-fp.ll
    M llvm/test/CodeGen/AMDGPU/fneg-fold-legalize-dag-increase-insts.ll

  Log Message:
  -----------
  DAG: Stop trying to fold FP -(x-y) -> y-x in getNode with nsz

This was increasing the number of instructions when fsub was legalized
on AMDGPU with no signed zeros enabled. This fold should be guarded by
hasOneUse, and I don't think getNode should be doing that. The same
fold is already done as a regular combine through isNegatibleForFree.

This does require duplicating, even though isNegatibleForFree does
this combine already (and properly checks hasOneUse) to avoid one PPC
regression. In the regression, the outer fneg has nsz but the fsub
operand does not. isNegatibleForFree only sees the operand, and
doesn't see it's used from a nsz context. A nsz parameter needs to be
added and threaded through isNegatibleForFree to avoid this.




More information about the All-commits mailing list