[PATCH] D77319: [DAGCombine] Remove the getNegatibleCost to avoid the out of sync with getNegatedExpression

Qing Shan Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 03:14:46 PDT 2020


steven.zhang updated this revision to Diff 257646.
steven.zhang added a comment.

Minor NFC update to the patch. 
To help the reviewer review this patch easier, I summarize the patch as follows:

1. All the changes in DAGCombine.cpp is NFC change, which is just some text replacement with new interface.
2. All the changes in X86 or AMDGPU is also NFC change, which remove the duplicated code of getNegatibleCost and make the getNegatedExpression logic more clean.
3. Inside the TargetLowering.cpp, I merge all the checkers in getNegatibleCost into getNegatedExpression before doing the negation. Most of them are semantics the same, except the FMA/FADD/FMUL. Old logic will return the cost immediately if the LHS is not expensive, which will make the cost of FMUL A, B, A=neutral, B=cheaper as neutral. We have to negate them both and decide the best cost.
4. The change in the PowerPC test is as expected.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77319/new/

https://reviews.llvm.org/D77319

Files:
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
  llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86ISelLowering.h
  llvm/test/CodeGen/PowerPC/qpx-recipest.ll
  llvm/test/CodeGen/X86/neg_fp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77319.257646.patch
Type: text/x-patch
Size: 41228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200415/5caff85b/attachment.bin>


More information about the llvm-commits mailing list