[PATCH] D78347: [DAGCombine] Checking the cost directly to improve the code readability

Qing Shan Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 23:57:56 PDT 2020


steven.zhang created this revision.
steven.zhang added reviewers: RKSimon, spatel, efriedma, arsenm, jsji, PowerPC.
Herald added subscribers: wuzish, hiraditya, wdng, nemanjai.
Herald added a project: LLVM.
steven.zhang added a parent revision: D78291: [NFC][DAGCombine] Adding three helper functions and change the getNegatedExpression to negateExpression.
steven.zhang added a child revision: D77319: [DAGCombine] Remove the getNegatibleCost to avoid the out of sync with getNegatedExpression.

This is a prerequisite patch for D77319 <https://reviews.llvm.org/D77319>. Now, we have to call getCheaperNegatedExpression() first, and it failed, call getNegatedExpression() again. It could be improved to call getNegatedExpression(Cost) and check the Cost to make the code more clear.

During negating the expression of N0 and N1, we are changing the DAG which change the combine order of the nodes though those negated node will be deleted immediately if combine is not profitable.  And that this reason of the case change, which LGTM.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78347

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/test/CodeGen/PowerPC/qpx-recipest.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78347.258237.patch
Type: text/x-patch
Size: 5435 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200417/8352e6f6/attachment.bin>


More information about the llvm-commits mailing list