[PATCH] D33840: [DAGCombine] Do not try to deduplicate commutative operations if both operand are the same.

Amaury SECHET via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 2 09:39:28 PDT 2017


deadalnix created this revision.

It is creating useless work as the commuted nodes is the same as the node we are working on in that case.


https://reviews.llvm.org/D33840

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp


Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -1569,7 +1569,7 @@
     SDValue N1 = N->getOperand(1);
 
     // Constant operands are canonicalized to RHS.
-    if (isa<ConstantSDNode>(N0) || !isa<ConstantSDNode>(N1)) {
+    if (N0 != N1 && (isa<ConstantSDNode>(N0) || !isa<ConstantSDNode>(N1))) {
       SDValue Ops[] = {N1, N0};
       SDNode *CSENode = DAG.getNodeIfExists(N->getOpcode(), N->getVTList(), Ops,
                                             N->getFlags());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33840.101231.patch
Type: text/x-patch
Size: 636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170602/39679cdc/attachment.bin>


More information about the llvm-commits mailing list