[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
Mon Aug 14 04:45:10 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL310832: [DAGCombine] Do not try to deduplicate commutative operations if both operand… (authored by deadalnix).
Repository:
rL LLVM
https://reviews.llvm.org/D33840
Files:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Index: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -1614,15 +1614,15 @@
}
}
- // If N is a commutative binary node, try commuting it to enable more
- // sdisel CSE.
+ // If N is a commutative binary node, try eliminate it if the commuted
+ // version is already present in the DAG.
if (!RV.getNode() && TLI.isCommutativeBinOp(N->getOpcode()) &&
N->getNumValues() == 1) {
SDValue N0 = N->getOperand(0);
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.110941.patch
Type: text/x-patch
Size: 1030 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170814/fb00904f/attachment.bin>
More information about the llvm-commits
mailing list