From: Nirav Dave Date: Fri, 29 Mar 2019 18:50:22 +0000 (+0000) Subject: [DAG] Avoid redundancy in StoreMerge TokenFactor generation. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b1825c3ad88467636f04904c10a5b1da31920175;p=llvm [DAG] Avoid redundancy in StoreMerge TokenFactor generation. Avoid generating redundant TokenFactor when all merged stores have the same chain. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357299 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 2cd698eb7e0..13e1e96cc92 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -14514,9 +14514,9 @@ SDValue DAGCombiner::getMergeStoreChains(SmallVectorImpl &StoreNodes, 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()); }