[llvm] r357299 - [DAG] Avoid redundancy in StoreMerge TokenFactor generation.

Nirav Dave via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 29 11:50:22 PDT 2019


Author: niravd
Date: Fri Mar 29 11:50:22 2019
New Revision: 357299

URL: http://llvm.org/viewvc/llvm-project?rev=357299&view=rev
Log:
[DAG] Avoid redundancy in StoreMerge TokenFactor generation.

Avoid generating redundant TokenFactor when all merged stores have
the same chain.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=357299&r1=357298&r2=357299&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Mar 29 11:50:22 2019
@@ -14514,9 +14514,9 @@ SDValue DAGCombiner::getMergeStoreChains
     Visited.insert(StoreNodes[i].MemNode);
   }
 
-  // don't include nodes that are children
+  // don't include nodes that are children or repeated nodes.
   for (unsigned i = 0; i < NumStores; ++i) {
-    if (Visited.count(StoreNodes[i].MemNode->getChain().getNode()) == 0)
+    if (Visited.insert(StoreNodes[i].MemNode->getChain().getNode()).second)
       Chains.push_back(StoreNodes[i].MemNode->getChain());
   }
 




More information about the llvm-commits mailing list